Integrate JavaScript

Integrate JavaScript

To use JavaScript in a form, it is necessary to create the file custom.js. The custom.js must be enriched with form specific functions. After editing, this file must be uploaded to the Administration Client in the tab Resources.

Call JavaScript functions when opening and editing the form

  1. Enrich the opening <form> -tag in the HTML code with the attribute initMethod="formSpecificFunctionName".

    <form class="classname" name ="formname" security="all" initMethod="initFormSpecificFunctionName"> </form>

     

  2. Enrich the custom.js file with an init function and insert all needed JavaScript functions in this function. This init function must have the same name as the name of the initMethod defined in the HTML form-tag.

    gadget.functions.initFormSpecificFunctionName = function(){ //do something }

     

Call JavaScript functions when saving the form

  1. Enrich the opening <form> -tag in the HTML code with the attribute validationMethod="formSpecificValidationFunctionName".

    <form class="classname" name ="formname" security="all" initMethod="initFormSpecificFunctionName" validationMethod="initValidationFormSpecificFunctionName"> </form>

     

  2. Enrich the custom.js file with an init function and insert all needed JavaScript functions in this function. The validationMethod must reply either 'true' oder false'. With 'true' it is stored and with 'false' it is not stored. This init function must have the same name as the name of the validationMethod defined in the HTML form-tag.