The most common form widget is the Single Field widget. This allows you to enter the value for a single field, with slightly different controls based on that field’s data type.
You can change the field used by the widget in the widget’s Edit dialog.
State: Editable or Text only
Most of the time you’ll want single value widgets to be Editable. If we just want to show the value of the field for reference, however, you can change a single value widget’s state to Text Only.
This is what a Text Only single value widget looks like when you’re using a form.
Type: Single line or Multi line
Single value widgets will often be Single-Line, but you can also change their Type to Multi-Line.
This allows forms to collect paragraph-stye text.
Values to show in Dropdown
One of the most useful features of forms is the ability to make data entry easier. The default option for “Values to Show in Dropdown” is None.
This allows the form’s users to type in any value they want in a field that looks like this.
If we choose “Other Record Values”, the “Allow Typing New Values” is checked by default.
This allows users to type in any value as before, but it also suggests existing values in the dataset that match what they’ve typed. This can save a lot of time during data entry.
We can also uncheck “Allow Typing New Values” when showing “Other Record Values”.
Users will then see a simple dropdown list of options they can choose.
When you choose to show “Specific Values”, you type in the values ahead of time. Here we’ve entered three specific companies that users can choose from, and “Allow Typing New Values” is unchecked.
The form will show our three companies in a dropdown list.
You can also check “Allow Typing New Values” when showing “Specific Values”.
This will suggest our three companies in a dropdown list, but also allow users to type in something else.
Another important feature of forms single value widgets is input validation. By default, input is optional.
You can also set validation to Input is Required. This means users will have to enter some value for the field.
You can set a minimum length of content. Here we’re saying users must type at least 5 characters.
You can set a maximum length. Here we’re saying users must type 20 or fewer characters.
You can also set both minimum and maximum lengths.
Finally, you can choose custom form validation and enter a regular expression. In this example we’re requiring the input to match any email address from the domains yahoo.com, hotmail.com, and gmail.com.
There are resources across the web to help you learn how to make a regular expression to match the text you want. We’ve found that RegExr is an online tool that works well for building the perfect regular expression.
Single value widgets can behave a little differently when you choose a field from a linked dataset. In this example we’re creating a single value widget for the “Customer” field in the linked Device Sales dataset.
When your form is on the “many” side of a one-to-many linking relationship, you can choose a single value like any other form fields. When your form is on the “one” side of the one-to-many linking relationship, you can choose multiple values from the linked dataset like in the example below.
You can even use single value widgets for datasets in many-to-many linking relationships that involve a third dataset for linking the other two.
For example, let’s say you have an Employees dataset and a Departments dataset. If you want your employees to be able to be in multiple departments, you’d set up an “Employee Departments” dataset with a field linking to the Employees dataset and a field linking to the Department dataset. You could then choose multiple departments in employee forms, and you could choose multiple employees in department forms.