Readonlyif (attribute of property)
The readonlyif condition determines if an input field should be read-only. A read-only field cannot be modified. However, a user can tab to it, highlight it, and copy the text from it.
The readonlyif attribute value is an FPath expression that must return a boolean result. This expression enables the developer to query the current value of the form properties in order to check a condition.
<property ... readonlyif="FPATH_CONDITION" ... />
A common condition for not allowing a property to be modified is depending on a boolean property. This example shows the form for an Item entity and how a "description" property of type text is made modifiable only when the boolean property "editDescription" is marked as true.
Note that the condition checks for the empty value first, as the "editDecription" boolean property has a null value when the form is opened for a new Item.
<entity label="Item" name="Item"> <property display="primary" label="Name" name="name"/> <property label="Edit description" name="editDescription" type="boolean"/> <property label="Description" name="description" type="text" readonlyif="editDescription = '' or editDescription = 'false'" /> </entity>