Form Submit Event Handling
The Form_Submit event is the primary entry point for handling user interactions when a form is submitted. Unlike earlier versions, this event provides a flexible and centralised way to control validation, messaging, navigation, and dynamic behaviour within your forms.
This document outlines common patterns and examples to help you implement custom logic effectively.
When to Use Form_Submit
Use the Form_Submit method when you need to:
- Validate user input beyond standard control validation
- Display custom error messages or feedback
- Perform server-side actions (e.g. sending emails)
- Dynamically modify form data or behaviour
- Control navigation between pages
Understanding Event Sources
Each action in a form (such as a button click) triggers an event source. You can use this to determine which logic to execute.
This allows a single Form_Submit method to handle multiple actions cleanly.
Common Use Cases
Custom Validation
You can implement custom validation and display errors in different ways depending on the context.
Control-Level Error
Displays an error message directly under a specific control.
Use this when the validation relates to a specific input.
Page-Level Error
Displays a general error message at the top of the form.
Use this when the issue affects the entire form.
Custom Error Display
You can store an error in the job and display it using a custom component such as a help panel.
Example component:
Setting Dynamic Data
You can modify job arguments during submission to dynamically change how the form behaves or what data it uses.
The form will regenerate using the updated data.
Showing Messages to Users
Popup Message (Stay on Page)
Displays a confirmation without reloading or navigating away.
Return to Previous Page with Message
Returns the user to the previous page and shows a message.
Navigation Control
You can programmatically control form navigation.
Go to Next Page
This is typically used after completing an action successfully.
Example Implementation
Below is a consolidated example demonstrating multiple use cases within a single Form_Submit method.
Key Takeaways
- Form_Submit centralises all submission logic
- Use event sources to separate behaviour cleanly
- Choose the appropriate feedback method (control, page, popup, or custom UI)
- Job arguments allow dynamic, data-driven form behaviour
- Navigation can be controlled programmatically