Simple validation and field format controls for mobile forms
XForms has a variety of controls available that let you dictate what fields on a form are required or optional, what values are allowed to be entered in specific fields, and what the field display formats should look like.
XF
XForms team
Aug 13, 2022

XForms has a variety of controls available that let you dictate what fields on a form are required or optional, what values are allowed to be entered in specific fields, and what the field display formats should look like. These controls can be split into validation controls and format controls, as described below.
Available validation controls
- Required (field cannot be left blank)
- Read-only (cannot enter any values into the field)
- Default value (specific value is pre-loaded into field)
- Minimum value (applies only to numeric and date fields)
- Maximum value (applies only to numeric and date fields)
- No Default Date (loads blank in date field)
- Show Time Zone (displays 3-character time zone in date field)
Available format controls
Date |
Time |
Number |
Text |
| US Standard (06/15/2021) | 12-hour (08:35 PM) | # of decimals (0 for integer) | UPPERCASE |
| Canadian Standard (15/06/2021) | 24-hour (20:35) | Minimum Value | lowercase |
| ISO Standard (2021-06-15) | Read-only (on-off switch) | Maximum Value | Title Case |
| Month Name (15-Jun-2021) | Required (on-off switch) | Default Value | Maximum Length (# of characters) |
| Required (on-off switch) | No Default Time (on-off switch) | Required (on-off switch) | Default text |
| Read-only | Show Time Zone (on-off switch) | Read-only | Read-only |
| Read-only |
When to use valid value ranges
You can set up a range of values that can be entered into certain fields of your form. In XForms, these are available for number and date fields, where you can enter a minimum value and maximum value.
A classic example of a number field using a valid value range is pH, which is a measurement used to specify the acidity of an aqueous solution. The pH scale goes from 0 to 14. You can’t have a pH below zero or above 14. So in XForms, you would create a number field to capture pH, and set the minimum value to 0 and the maximum value to 14. Then when a field user enters a pH value into that field, they can’t enter a number like 77 (maybe they meant to enter 7.7 but forgot to tap on the period).
An example of a date field with a minimum and maximum value could be a birthdate field. you could set a minimum date of January 1, 1930 and a maximum date of January 1, 2022. The thinking there is that no one using the system is going to be a baby or toddler. I personally don’t find this optional setting important, but there are certain use cases where it might be.
How to use “No Default Date” or “No Default Time” validation controls
A typical use case for using the “No Default Date” or “No Default Time” control is when you have an end date or end time on a form and want to force a user to enter the end date or time. In this use case, you would set that field to required and to No default. Then when the form first loads, no value is pre-loaded into the field, and the user can’t submit the form until they enter a value. Here’s what that looks like in the Designer:
How to use the text field format controls
Here’s an example illustrating the use of format controls in a text field. In the example below, the well_id field is set to display text in uppercase, with a maximum text string length of 15 characters, and a default value of MW-. So when the user loads the form, this field will preload with “MW-” and anything the user types into that field will be converted to UPPERCASE. The field will also truncate anything entered past 15 characters.
While not fully comprehensive, the currently available validation and formatting controls in XForms are simple and not overly complex, and should provide enough options for most use cases. Our intent is to add additional formatting and validation controls over time as needed by our customers, but only in ways that are simple to understand and implement.
Want to learn more?
Click/tap the button below.
TRY XFORMS
Wanna give it a try, risk-free?
Build a form, capture a record offline and see it land in your dashboard.
XF
WRITTEN BY
XForms team
Keep reading
XForms Mobile
Sep 5, 2025
Tracking waste from cradle to grave using smartphones + AI
How do you ensure that the decarbonization end-product you are paying top dollar for originated from actual waste, and not virgin material?

XForms Mobile
Mar 2, 2025
Photos in table rows
Now you can take a photo within a table grid row, enabling you to take pictures of something specific and relevant to the information in that row of your table.

XForms Mobile
Jan 6, 2025
Photo metadata improvements
Photo metadata is now captured at the photo level instead of at the form level. This enables viewing of the geolocation of each photo taken, which could differ for each photo captured on the same form.
NEWSLETTER
Get new posts in your inbox
Product updates, field-tested how-tos and customer stories from XForms Mobile, Cx and XDocs.
New blog newsletter signup
One email when we publish. Unsubscribe anytime. or request a demo →




