Styling can be designed uniformly for all elements of a type. It is also possible to configure individual styles for individual elements in order to emphasize them.
There is also a third option: conditional formatting.
This means that certain styles are only applied if the condition is true. This offers a great alternative to field validation.
The problem with field validation is that someone can add a great deal of information to a form, and then find that they cannot save it due to one field not meeting the validation criteria. Conditional styling will bring attention to the user that something isn’t as expected. But it still allows the form to be saved.
To set conditional formatting in your SharePoint Form Design you have to complete the following steps:
- Click the "Styling" button from the skybow command bar.
- Locate the element that you wish to apply the styling to from the "Control Styles" section.
- Add a style to the element by clicking the three dots next to the control.
- Provide a name for your style.
- Add a condition using the Expression Builder, e.g. [[Status]]==”Approved”.
- Apply the styles such as Field Input to contain a green border.
- If you wish to add an additional conditional style to the same field (e.g. red if status is rejected), you can click " + Add Style" on the three dots next to the field, and add a similar condition with a different name.
- Optionally, repeat the same condition and style for other controls such as the status tab.
Note: Conditional Formatting is often more useful on EditForms and DisplayForms when checking the status, since the status would usually always be Null or Pending on the NewForm.