enableIf, conditional enable/disable
Grey out a field unless an expression returns true. The field stays visible, just locked from editing.
The enableIf rule disables a field unless an expression returns
true. Differs from visibleIf
in one important way: the field stays visible, just locked from editing. Use it when
the user benefits from seeing the field (knowing it exists, planning ahead) but
shouldn't be able to change it yet.
The shape
Inline in the designer property panel
{TermsAccepted} == true
Combine conditions
{Status} != "Closed" and {AssignedTo} == [Me:Email]
enableIf vs the static locks
enableIf is the conditional way to lock a field. The others are static, and the
runtime renders them differently, so the choice is not just a matter of taste:
| Property | Description |
|---|---|
enableIfexpression | Write the expression for when the field should be editable; while it is false the field is locked. The real control stays on the page, greyed, and becomes editable again the instant the expression turns true. |
readOnlyboolean | A permanent lock. The control is replaced by a read-only value display rather than a greyed input, because nothing on the form can unlock it. |
readOnlyOnNew / readOnlyOnEditboolean | The same permanent lock, limited to one form mode. Use these for "set once at creation" values instead of writing a mode test into the expression. |
There is no readOnlyIf. For a "lock it once X has happened" rule, write the
enableIf the other way round: {Status} != "Approved" rather than a lock rule
for {Status} == "Approved". See the
read-only reference for all six sources of read-only state and how each one renders.
Limiting which form mode the rule applies to
Same shape as visibleIf, the Rules panel under the rule builder
exposes three checkboxes (New form / Edit form /
Display form) that restrict where the rule is evaluated. All three checked =
applies everywhere (default). Uncheck a mode to make the rule inert there. Persists as
data-f365-enable-if-modes CSV; the attribute is dropped when all three are selected.
(Note: the whole form is read-only on Display regardless, so including Display in this list is
harmless but academic.)
Related
Related articles
- visibleIf, conditional visibility
Hide or show any field, section, or button based on the value of other fields. Express the condition once; the runtime evaluates it on every change.
- Read-only rules
Lock a field from editing. Six sources of read-only state, OR'd together, and the two different ways the runtime renders the result.
- Audience trimming, group-based visibility & enable
Show, hide, enable, or disable fields based on SharePoint or Entra group membership, no code required.