> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloneable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Lock a field with a rule

> Make a field read-only always, or only while a condition or formula is true, using When it's editable in the template's field settings

A field can be locked always, or only while a rule is true. For example, lock the owner once the pole is marked as verified, or lock a field while the linked plant pole belongs to another owner. Crews still see a locked field's value. They can't change it until the rule stops being true.

## Lock a field always

1. Open the template and select the field.
2. Open **When it's editable**.
3. Tick **Read-only**.
4. Save the template.

A field filled by an **Auto** binding under **Auto-fill** is always read-only. The box shows **set by Auto-fill**. Switch the binding to **Suggest** to make the field editable again.

## Lock a field while a rule is true

1. Open the template and select the field.
2. Open **When it's editable**. Leave **Read-only** off. While it is on, the field is always locked.
3. Under **Or lock it conditionally**, choose one (**Never** means no conditional lock):
   * **Only when…**: build a condition from the record's fields. It can also read a linked object, see [Rules that read a linked object](https://docs.cloneable.ai/guides/forms/rules-on-linked-objects.md).
   * **Expression**: a formula that returns `true` while the field should be locked, for example:
     ```js theme={null}
     data.verified === 'Yes'
     ```
4. Save the template.

## What crews see

* While the rule is true, the value is shown read-only. Its ⓘ popover says "Locked when …".
* When the rule stops being true, the field is editable again straight away.
* A rule that is broken, or an expression that stops with an error, leaves the field **editable** and shows a rule issue.

## What a lock doesn't do

* It only stops people typing. Calculated values and suggestions still fill the field.
* A hidden field stays hidden. Locking doesn't show it.
* The lock applies in the Cloneable web and iOS forms. It isn't a check on data that arrives from imports or integrations.

> [!NOTE]
>
> An iOS app from before conditional locks shipped ignores the rule and leaves the field editable. A field with **Read-only** ticked is locked on every version.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.