This article provides a guide on how to utilize Submit Rules with Form views in your Knack app.
What are Submit Rules?
Submit rules determine the destination where the user will be directed to upon successful form submission. This aspect plays a vital role in establishing workflow as it allows you to redirect users to different forms or any other accessible page within your app.
Building Submit Rules
Submit rules can be accessed in the Settings menu of your Form view. Select the "Rules" option under the Form Menu and Submit Rules on the following menu:
Adding a Submit Rule
Each form will include one submit rule by default. This rule cannot be removed.
You can add additional submit rules by clicking the "Add Rule" button below your default submit rule:
Editing an Existing Submit Rule
The criteria for your submit rule can be edited directly in the settings screen. You can also rearrange the order of your Submit Rules by selecting the icon on the top left corner of the rule and dragging it above or below your existing rules:
Copying a Submit Rule
You can copy existing submit rules by selecting the copy icon in the top right corner of the rule. The copy of the rule will then appear below the original rule.
There are five available actions for your submit rule. The selected action determines what happens after your form is successfully submitted.
Show a Confirmation Message
After submission, the form will fade out, and the confirmation text will appear.
There are two additional options here:
Show a link to reload a form
Automatically reload the form
Below is an example of a form that displayed a confirmation message and a link to reload the form once the form was submitted:
Redirect to an Existing Page
Upon successful submission, the user will be directed to a designated page within your app. Submit rules have the ability to redirect users to both parent/top-level pages and any child page that utilizes the same data source as the form.
Redirect to the Parent Page
Upon successful submission, the user will be automatically redirected to a parent page. This is particularly useful when your form adds a child record and you want to guide your users back to a page that displays all parent records.
Upon a user creating a record, they will be directed back to the parent page where they can view a grid displaying all records for that table.
Upon form submission, redirect the user to a page with a rich text view which serves as a "thank you" page.
Redirect to Another Website's URL
Upon successful submission, users have the option to be redirected to any URL of their choosing. For instance, they can be directed to an existing "thank you" page as a way to conclude their workflow.
Redirect to a New Child Page
This option allows you to establish a new child page to direct the user to.
You have the flexibility to incorporate any desired views on this page, and it will seamlessly integrate with the form's record. This empowers users to swiftly add a new record and be instantly redirected to the relevant views of that specific record (such as a details view).
These are the conditions that trigger the submit rule:
Multiple conditions can be added for each rule based on field values by clicking on the green "+" button next to your rule. It is important to note that if you add multiple conditions, all of them must be true for the submit rule to trigger.
Notes & Troubleshooting
If a submit rule does not seem to be working, make sure you don’t have a second one with the same trigger, as the second one will take precedence over the first.
It is important to note that you cannot add "When" conditions to your first, or default, submit rule. The default submit rule will be triggered for every form submission that does not match any other submit rule.