Sometimes it might be beneficial to only allow fields to be filled in for a limited time. That's why we offer the option to disable fields, based on different conditions.
Disabled fields show the filled in data, but cannot be edited or filled in anymore.
They can be used in two ways:
- To create new items: In combination with the prefilled option, this would result in standard, unalterable but viewable data in a new form.
- To update existing items: By using disabled fields, you can allow the editing of certain fields and still show the the other fields and their data.
To disable a field, simply click the 'pencil' icon next to its label.
A modal will appear with different field options. Select 'Disabled from the list.
Switch 'Disabled' to 'on'. You will now see the disabled-specific options appear.
The first three options cover the conditions in which the field will be disabled:
- Always: The field will always be disabled, regardless of data or condition.
- Between: The field will be disabled between the two dates specified. These dates can be any date field present in the app.
E.g. You want to allow a customer to change an appointment up until a week before the appointment takes place. You do, however, want them to change certain other information in the form as well as view the appointment info.
- Eval: When selected, this option allows you to enter a pure Ruby code statement. This statement should return true or false. When it returns true, the field will be disabled. You can use the 'record' keyword to access data from the form.
E.g. The age of the client is evaluated as underage, which results in certain options and fields being disabled.
The last two options cover the layout options for disabled fields:
- Dynamic View: The data is displayed as if it were not a form field but part of a text paragraph.
- Disabled input: The data is shown in its original input field but greyed out and unchangeable.