Rules
A rule shows, hides, locks or requires a field or a control while another field of the form has a given value. Rules work in the classic and in the modern SharePoint forms, and in the Modern form preview. No code is needed.
Add a rule
- Select the field or the control on the form. Tabs and accordions have rules for each section too.
- In the Rules section of its properties, press Add a rule.
- Choose:
- Action: Show when, Hide when, Read only when or Required when (fields only);
- Field: a field that is on the same layout;
- Condition: equals, does not equal, contains, is empty or is not empty;
- Value, for equals, does not equal and contains: one of the choices of a choice field, Yes or No for a Yes/No field, or the text to compare with.

To delete a rule, press Remove the rule (the bin icon next to it).

How several rules combine
- With Show when rules, the element is shown only while at least one of them is true.
- Hide when, Read only when and Required when apply while any of their rules is true.
- Rules come on top of permissions: an element hidden or read only for a person by its permission stays so whatever the rules say.
Example
In the Service requests list, the Laptop model field has the rule Show when Request type equals Hardware. A person who chooses Software does not see the field; with Hardware, it appears. The Approver comment field has the rule Required when Approval status equals Rejected, so an approver must explain a rejection.

If you remove from the layout the field a rule looks at, the rule shows The field is not on the layout. Add the field back or change the rule.
Rules replace what the classic forms did with JavaScript for showing, hiding and requiring fields. Validation, calculated values and cascading lookups still need JavaScript, which runs in the classic form only.