A form view is used to add or edit a record in your database.
How Forms Work
Forms are used to insert or update records for one of the objects in your database.
Any of the object fields can be used as form inputs to be filled out by the user.
A form can insert a new record or update an existing record. This is determined by how the form is added (see below).
Add a Form to Insert New Records
You can add a form by selecting the Form option from the views toolbar at the top of any page:
Select the object you want to insert a new record into, and then click the "Add form" button:
Add a Menu That Links to a Form
A common practice is to add a menu that links to a form above a table of records:
Add the form in the same way as above, but this time check the "Link to this form from a menu" box:
You can then drag and drop the menu above the table to change the order so the link is at the top of the page:
Add a Form to Update Existing Records
You can add a form to update an existing record on any details or edit page. Simply select the Form option from the views toolbar and you'll have the option to add a form to update the record:
You can also add forms to update records automatically when adding tables or other views displaying multiple records. You'll be given the option to link each record to a form to edit that record:
Add a Form to Insert a Connected Record
If your app is using connections, you can add forms to insert connected records to any page displaying details about the parent record.
For example, in our Contact Directory example app, you can add a Form view on a Company details page to add a new Contact record connected to that Company.
Select the Form option on any details page and then select the connected object from the "A new record connected to this page's Company" list:
See below for more on using connections with forms.
Click directly on a form in your pages to edit it:
The form will open in "edit" mode where you can use the menu on the left to edit different aspects of the form.
The Data Source section displays more information about the record being inserted. For example, if you're adding a Contact connected to a specific Company:
When forms are added to insert a connected record (see above), the connection is automatically set by Knack behind the scenes. You won't have to add a connection look-up field to make the connection.
Otherwise you can add connection fields to your forms like any other fields. Connection fields work like "look-ups", where the user can look up a specific record or records to connect to.
The Inputs section determines which fields can be entered in the form:
When you add a new form all the fields are added as form inputs by default. You can add and remove inputs, change the layout and order, and edit options for each input.
A title and description are listed above the inputs, and you can click on each to add or edit. These are optional and will display at the top of the form if added:
Add Field Inputs
The left menu lists all the fields available to add as inputs.
Click on a field to add it to the list of inputs on the right. Each field can only be added once, so once added the field link will gray out. When added each field will preview with an input based on the field type.
Add Connection Field Inputs
In a form, a connection field connecting to a single record looks like a drop-down with the added feature to dynamically search the available choices:
A connection field connecting to many records is similar, but lets you select more than one record at a time:
You can continue to select available records to connect to.
Add Special Inputs
The left menu has a Special tab you can click to add special fields to your form:
You can add special Title/Instructions field that lets you insert titles and text throughout your form.
Fields are organized into groups that can be laid out into one, two or three columns. When you hover over a group a "Layout" selection appears at the top to change:
Click the "Add Group" button to add multiple groups. The active group will have a gray background. Any fields you add as new inputs will be added to this active group. Click on any other group to make it active:
You can change the order for any input by dragging and dropping it into a new location. If you have more than one group you can click on the move icon above a group and drag to change the order:
Hover over an input and click the "pencil" icon to edit that input:
A window is displayed to edit that input:
Read Only: will display the field’s value without an option for editing the value. This option is only available on edit forms.
Label: the label that displays with the input. This defaults to the field name.
Instructions: add additional instructions for using the input. This will display in smaller text below the input.
The following fields have additional options you can edit:
Multiple Choice fields have options to add additional choices directly from the form:
This presents the user with a "plus" icon they can click to add additional options right from the form:
Connection fields have three additional options:
1. Selecting "Allow users to add new options" creates a child form that the user can access to add additional records directly from the form. A "plus" icon will be available to add a new option:
This will then pop up the form to add a new record:
This form can be managed in pages like any other form:
2. When you have multiple connection fields on a form and they are connected to one another, then you will have the Show option for limiting which connected records are available to select from.
For example, you can have a Departments object connected to the Companies and Contacts object, so you can select the Department that a Contact belongs to based on the Company they’re a part of.
On a Contact form, you can edit the Departments input to show only those "Departments connected to this form’s Company":
When a specific Company is selected on the form, only that Company’s Departments will show up for the Department field:
3. Connection fields can have filters added to limit which connected records are available to select from:
Hover over an input and click the "trash can" icon to delete that input:
If you need to add a new field to your form that doesn't exist yet, you'll first need to add it to your database.
If you change the field name in the database, every existing input label will be updated unless the label has been changed to something different.
You can add powerful workflows to your forms with different Form Rules. There are three different types of Form Rules, submit rules, display rules and record rules.
Knack Tip These are triggered in the following order: display > record > submit.
Submit Rules determine what happens after a form is submitted:
Show a confirmation message: after the submission, the form will fade out and the confirmation text will appear. There are 2 additional options here: Show a link to reload a form and Automatically reload the form.
Redirect to the parent page: after the submission, the user will be redirected to a parent page. This is perfect if you're adding a child record and want to quickly go back to a parent list showing all those records.
Redirect to an existing page: after the submission, the user will be redirected to the selected page.
Redirect to another website's URL: after the submission, the user will be redirected to the entered URL.
Redirect to a new child page: create a new child page to direct the user to. You can add any views you wish to this page and it will automatically work with the form's record. This means you can insert a new record and immediately show other views for that record.
When: the criteria to trigger the Submit Rule. The first rule present is the default action that will trigger when no other rule is met.
You can add multiple criteria to each rule based on field values, in which case every criteria must be true.
Display Rules control how the form is displayed. You can show and hide form inputs and change input labels based on other form and record values.
These rules are checked and triggered when a user changes the value of a form or an edit form is initially populated.
A Display Rule is added by defining the conditions (if) that trigger the actions (then):
If: the conditions that will trigger the actions when each condition is true. More than one condition can be added to trigger the action, in which case every condition must be true.
Then: the action to trigger when the condition is met:
Show/Hide: show the input when the condition is true, hide it when it is false.
Show: show the input when the condition is true.
Hide/Show: hide the input when the condition is true, show it when it is false.
Hide: hide the input when the condition is true.
Rename Label: change the label of the input when the condition is true.
Multiple conditions and actions can be added for each rule by using the green "plus" button.
A great use case is adding an "Other" option for multiple choice fields. When the user selects "Other" you can show another text input to add that other option:
The "other option" will need to be a field in your database so that it can be stored with each record.
Record Rules add or update records in your database. For example, you can insert or update a connected record, or update the form's record.
A record rule is added by defining an action and the conditions (when) that trigger the action:
Action: the action to take when the rule is triggered:
Update this [the form’s] record: useful for setting status or workflow fields on submissions. You can also assign logged-in users, so you can track who submitted a comment, rating, or ranking on a form.
Update connected records: similar but updating any records connected to the form's record.
Insert a connected record: add a new record connected to the form record. Your form's object must be connected to other objects for this option to be available. Great for adding history, version, and archived records based on the submission.
When: the criteria to trigger the rule. Add criteria based on one or more form values, or you can run the rule for every form submission. Multiple criteria can be added, in which case every criteria must be true.
When the action is inserting or updating records you can also set one or more Values for those inserts and updates. Values can be set to:
a connected value: choose a field from a record connected to the form record.
a custom value: enter a value manually.
a form value: choose one of the form inputs.
Trigger emails to be sent after a form is submitted:
Send a basic email notification: Send an email containing all form inputs to an email address of your choice.
Send a custom email: Customize your email contents and recipients.
When: the criteria to trigger the Email to be sent. Add criteria based on one or more form values, or you can run the rule for every form submission. Multiple criteria can be added, in which case every criteria must be true.
Send: customize your Email recipients. When an email field is chosen, the email address added to the form record will be used. If the field is on a connected object with multiple records, an email will be sent to each connected email address. Recipient options include:
To: the main recipient.
CC: recipients who should receive a carbon-copy of the email.
BCC: recipients who should receive a blind carbon-copy of the email.
Reply-To: the email address where email replies will be sent to.
From Email: the email address the recipient will see as the "From" email address.
Email Subject: the subject the recipient will see for the email. You can use form field values in the subject line.
Message: the message can be created by combining your own text and any fields available in the form record. Click on a field from the menu on the left to add it to the message. In the example above, both the Name and Birthdate fields have been added. When the email is sent those fields will be replaced by the actual values from the record. There are 3 template variables you can add to your message body:
Record ID - Include the internal ID for the record. This comes in handy when you want to add a link to edit/view the specific record.
Page URL - Include the URL for the form where the email is originating from.
Parent Page URL - Include the URL for this form's parent page, if a parent page exists.
Knack Tip HTML can be added directly into a custom email for additional formatting options.
The Options section lets you control different form elements, like the Submit Button Text or Reload Form Text:
If the form's object has a numeric field, you can enable an E-Commerce Checkout. You can learn more about E-Commerce here: About E-Commerce.
Equations and Calculators
Forms can be used as online calculators by adding equation fields to the form. If you add the inputs that the equation uses to the form, then the equation will automatically update as the user updates those fields.
Here's an example of an online calculator for calculating employee compensation based on a sales commission:
This will generally only work for simple equations like the above example. Current limitations include:
Only numeric equations will work, date-based equations currently will not.
All values for the equation need to be present in the form for the equation to calculate live.
If values from connected records are needed, then the equation won't update automatically.