Pretty Forms Designer provides functionality to add logic to your form. The added custom logic enables your form to change itself or make updates in the form items on certain conditions.
The added logic would be automatically triggered & processed on certain events. There are many kinds of events produced in the forms created using the Pretty Forms Designer Add-on. In this article, we will see about various types of events and triggers used to run your custom logic in Google Forms.
Form Triggers associated logic would be run on the form-level events. To add a custom logic under the Form Triggers, click on the “More Options” icon button in the top right corner of the Form Designer and then click on the “Form Triggers (Events)”.
This will open a dialog in which the following events & triggers will be displayed, you can add the logic by clicking the “Open Trigger” button.
On Form Load
Description: Calls when the form is initiated & is going to be displayed on screen. The trigger for this event automatically runs the associated logic only once when the form is opened by the user.
On Form Before Submit
Description: Calls before the form is submitted. The trigger for this event automatically runs the associated logic when the user presses the Submit button. You can perform data & answer values validations in the logic, if you find any error in the answers entered by the user, you should show the error text in that answer item & also return an error text which will be shown to the user & stop the form submission.
Return: Error text or Nothing.
Return an error text, if the answers are not valid and that error text will be shown to the user, and will not submit the form.
Do not return any text, if the answers are valid and would go further for the form submission.
On Form After Submit
Description: Calls after the form is successfully submitted. The trigger for this event automatically runs the associated logic only once when the form is successfully submitted. In the logic, you can display an alert to the user or redirect to another URL on the successful form submission.
Form Item Triggers
On Answer Value Changed
Description: Calls whenever the answer value is changed. The trigger for this event automatically runs the associated logic whenever the user writes / updates / clears an answer value or any choice is selected/unselected in the answer. You can perform validations on the current answer value or with other answers' value & show an error text if any answer is not valid.
To add the logic for this trigger: Select an answer item, click on the “Options for item” icon button for the selected item and then click on “On Answer Value Changed Trigger”.