Defaults & validation
Two ways to make a field smarter without writing code.
Default value
"What value should this field have when a new record is created?"
Defaults pre-fill the form so the user only types what's actually different. Less typing = fewer mistakes.
Common defaults
| Field | Default | Why |
|---|---|---|
| Status | draft |
New records always start as drafts |
| Created at | today() |
Auto-stamp on submission |
| Country | Malaysia |
Most records are local |
| Quantity | 1 |
One is the most common |
| Active | Yes |
New records start active |
Setting a default
Open the field's properties and put the value in the Default box. The platform handles the rest — the form pre-fills, and saved records that don't override the default keep it.
For dates, the special values today() and now() are recognised.
Validation — extra rules beyond the type
The field's type already does basic validation (a Date field rejects "yesterday morning" — only real dates pass). But sometimes you need more.
When to add a rule
- Length limits — IC number must be exactly 12 digits.
- Allowed values — Status can only be
draft,submitted,approved,rejected. - Number ranges — Days requested must be between 1 and 30.
- Format — Phone must start with
+60or0.
How to add a rule
In the field's properties, open Rules and click Add rule. Pick the rule type, fill in the parameters, and provide an error message:
Type: Min length
Value: 12
Message: IC number must be at least 12 digits.
The form checks the rule before saving. If it fails, the user sees your message in red next to the field.
Common rules
| Rule | Use it for |
|---|---|
| Min length / Max length | Codes, IC, phone |
| Min value / Max value | Days, quantities, amounts |
| Pattern (regex) | Postcodes, custom IDs |
| One of (in list) | Status fields, allowed types |
| After / Before date | End date must be after start date |
Tip
Don't pile on validation. The right type + Required does ~80% of the work. Add custom rules only when you've seen a real mistake users make.
Where to next
- Where fields show — control what appears on which screen.
- Common mistakes — six small mistakes that bite first.