How to add your own validations |
If the validations provided by Simfatic Forms does not meet your need, you can add your own custom validation function. The custom validation function need to be in JavaScript and runs only on the client side.
Steps for adding a custom validation functionYou can add the custom validation function in the 'Input Validations' page. 1. Click the 'Validation Options' LinkClicking the validation options link displays the validation options page on the right side.
2. Check 'Custom validation function'There is a check box 'Custom validation function'. Enable it.
3. Press the button 'Edit Custom Validation function'Pressing the 'Edit Custom Validation function' button opens an editor where you can provide the JavaScript code for the validation.
4. Provide the custom validation codeEnter your validation code. If the validation fails, it should return an object containing the error message and the element object to which the error belongs to.
Example: if(formobj.elements['Name'].value == 'Bob') return true;
See Also:
|