Common attributes
Most field types share a set of core attributes. Field-specific pages cover everything not listed here.
Identity
type: Field type name (for example,TextField).key: Stable unique identifier. Prefer keys for conditions and references.data_name: Value identifier used in engine state.label: Label shown to users.
Description and display
description: Optional helper text.description_mode:defaultorsubtext.display: Visual style, varies per field type.
Visibility, required, and read-only
visible: Base visibility (boolean).visible_conditions: Condition object; overridesvisiblewhen present.visible_preserve_value: Whether a hidden field keeps its value (boolean, optional). See Clear a value when a field is hidden.required: Base requirement (boolean).required_conditions: Condition object; overridesrequiredwhen present.read_only: Base read-only flag (boolean).read_only_conditions: Condition object; overridesread_onlywhen present.
Clear a value when a field is hidden
A hidden field keeps its value by default. The value stays in the form values, is saved with the
record, and still counts in calculations. Set visible_preserve_value to false when a hidden
answer should not be kept, such as an email address after the user chooses to be contacted by phone:
Code
This example shows only the attributes that matter here.
When the field is hidden, its value becomes null. This applies to:
- fields hidden by their own condition or by a parent
SectionorRepeatableSection, including inside closed rows; and - fields that start hidden, including their
default_valueand any loaded value.
The other rules are:
- Showing the field again leaves it empty. form0 does not restore the old value or apply
default_valueagain. - A read-only record keeps its stored values.
- In the saved record, a cleared field looks like any other empty field. Rows, their IDs, and their metadata stay.
- Clearing a media or link field removes only the reference. The file or linked record is not deleted.
These input fields support the attribute: TextField, NumericField, SingleChoiceField,
MultiChoiceField, BooleanField, DateField, TimeField, PhotoField, VideoField,
SignatureField, and FormLinkField. Containers, labels, calculated fields, and generated titles
and statuses do not.
Try it
You need form0-cli.
-
Download the example form and start the preview:
Code -
Open
http://localhost:3030. Theemailfield setsvisible_preserve_valuetofalse, and thephonefield leaves it out. -
Choose Email, enter an address, choose Phone, and then choose Email again. The Email field is empty.
-
Choose Phone, enter a number, choose Email, and then choose Phone again. The number is still there.
Default value
default_value: Initial value for the field (type-specific rules apply).
Supporting images
supporting_image: Enables a supporting image.supporting_image_path: Relative or absolute image path.supporting_image_display:defaultordialog.
AI metadata
ai: Optional AI metadata for field-level guidance.
Field-specific rules
Some fields lock values (for example, CalculatedField.read_only is always true). Always check
the field type page for specific constraints.