hub.eb?material_id=360&track_id=357

On Error Event


The On Error event is a Form-level event that runs whenever an error in execution is encountered, typically within a script.

If no On Error event has been defined then a default error page will be displayed. By defining On Error event(s), you can fail gracefully and display an error message of your choosing and, if suitable, continue execution.

To add an On Error event, go to Form Properties > Events and select the On Error tab. You can add an existing script or create a new one .

Steps


1

Create a Form and a Field called myField.

Add a Button Control to the page called myButton.

2

Add a new On Click event script for myButton. Name the script myBrokenScript and add the following code:

fields.myField.value = undefinedVariable;
3

Run the Form and click the button. You will be shown the default Verj.io error page.

4

Add a new On Error event script to the Form. Name the script myOnError and add the following code:

controls.myButton.addErrorMessage("There was a problem with your request.");
5

Run your Form again and click the button. You will now see your custom error message displayed on the page.

Current Module

Related