- I have basicly removed the 'AlertErrors' and 'ShowHtmlError' options and replaced it with another option called 'ErrorHandler'.
The option 'ErrorHandler' can have 3 values: 'html' OR 'alert' OR 'custom'.- html: if set to 'html' the script will act the same as with the (now removed) 'ShowHtmlError' option (a.k.a. show a list in html containing all the error messages)
- alert: if set to 'alert' the script will act the same as with the (now removed) 'AlertErrors' option (a.k.a. show a Javascript alert message containing all the error messages
- custom: a custom (user defined) function will be called (The name of the function can set with the option 'CallbackNoSucces')
- I also added the optional 'CallbackNoSucces'- option. This option accepts any user written function. The set function will be called when the user clicked the submit button, but the form isn't filled in correctly. When this function is called 3 parameters will be send along:
- field: contains the field as an actual object. For example: To know the fieldname you can use something like
array[0].field.name
- isFieldValid: (boolean) 'true' when the field is filled in correctly.
- errorMessage: the error message that would have been shown if errors would have shown in an alertbox (or as an html list).
- field: contains the field as an actual object. For example: To know the fieldname you can use something like
- I renamed the option 'CallBackFunction' to 'CallbackSuccess'
On a final note: the value of the 'ErrorHandler' options is currently case sensitive!
The script can be found on https://github.com/nathanh752/MyHTML5Webforms