Script for your forms
The xsforms object is supported in Flex only.
This is the initialization function that is called when a page or dialog containing a form loads. The parameter “n” is the id of the form. If xsforms exists, it will be called for every form, use the “n” parameter in your script to handle specific forms. For example, the value of “n” will be “contactusform” if called from the Contact page.
This function is called after init() and before the standard form initialization function is called. The standard function e.g. initializes the input elements (date inputs, drop downs and so on), and it adds classes (required fields) based on the forms settings that you have configured in back office.
This function is called after “onbeforeinit”. You can use it to e.g. manipulate inputs and classes after the normal initialization has completed.
If “onvalidate” exists, this function is called before the standard input validation function. You can return false to prevent the form from being submitted, you must return true to make sure that the rest of the functions are called (or else the form will not be submitted). Note that the standard form validation function is called after your own validation function – provided that you return true to indicate that the form may be submitted.
This function is called after form validation has completed but only if the form is ready to be submitted, i.e. if validation was successful. Return true to submit the form or false to prevent the form from being submitted.
If the form is an email form (e.g. the contact us page) then the function aftersendmail() is called after the form has been successfully posted. If you use this function, then the standard function is not executed. The variable “d” is the JSON object that is returned by the standard script.