Data Controllers / Data Fields

  Read-Only When

Table of Contents
Data Controllers / Data FieldsPrint||
Read-Only When

Data fields can be rendered as read-only if a field-level JavaScript expression evaluates as true for a given data row.

For example, the Customers edit form has a Region data field. Let’s configure this data field to only be editable when the Country is “USA”.

Region data field is editable by default in the Customers edit form.

Start the Project Designer. In the Project Explorer, double-click on Customers / container1 / view1 / editForm1 / c1 – Customers / Region data field node.

Region data field in editForm1 of Customers controller.

Change the Read-Only When property:

Property New Value
Read-Only When [Country] != 'USA'

Press OK to save the data field. On the toolbar, press Browse.

When the application loads in your browser, select a customer that is not from the USA. The Region data field will not be editable.

Customer not from USA does not have an editable Region data field.

Select a customer that is from the USA. The Region data field will be editable.

Customer from USA does have an editable Region data field.