How can I add Auto Serverside Validation?
Published: Monday, 29 June 2015 19:22
To enable Auto Serverside Validation drag an Auto Serverside Validation action from the Validation actions group into the On Submit event of your form.
Then drag an Event Loop action from the Core actions group into the pink On Fail event box of the Auto Serverside Validation action. Without this the validation action will not report any errors. Leave the default settings of the Event Loop unchanged. They should be Target Event: > On Load and Quit Next Actions: Yes
Open the Auto Serverside Validation action and add the input names of the inputs that you want to validate in the appropriate boxes e.g. Phone might be home_phone,work_phone
The Required box only checks that a result has been submitted, an empty result will still be accepted. Use Not Empty with Required to check that a value has been sumbitted.
Once you have entered the appropriate input names then Click the Error Messages tab and make any changes that you required. Note that the same message will be shown for all inputs with the same validation, the input name is not includes. Because of this you may want to keep the message wording general. See this FAQ
for more on handling Serverside Valdation error messages.
If you need more sophisticated Serverside Validation with more customised messages you can use the Custom Serverside Validation action to create them.
In ChronoForms v5 there is a Server Validation action in the Validation Group. This action allows you to make some general settings, then has a series of boxes for different kinds of validation: Not empty or 'required'; Empty; No spaces; Alpha; Alphanumeric; . . .
In the boxes you add entries in the format of input_name:Error message. So, for a contact form you might add entries like this.
In the Not empty box:
first_name:Please enter your first name
last_name:Please enter your last name
email:Please enter your email
and, in the Email box:
email:Please enter a valid email
Save the action, then drag an Event Loop action into the pink On Fail box to re-load the form when an error occcurs.
There are no Custom Validation options in this action but you can use an Event Switcher action to add custom validation if it is needed.