Here’s a quick and simple way to put a red border on a text box that’s mandatory but hasn’t been completed:
In Theme, Assets, go to ‘Configure roles…’, add a new role and add ‘TextBox’ to its component types. I called mine ‘mandatory-textbox’
Add two entries to ‘theme.css’:
.anvil-role-mandatory-textbox:placeholder-shown {
border: 1px solid red;
}
.anvil-role-mandatory-textbox:-ms-input-placeholder {
border: 1px solid red;
}
The second entry is to make this work on Internet Explorer and it has to be a separate entry in order to work.
Now, for any mandatory text box, ensure that the ‘placeholder’ property has some content and it will have a red border if the placeholder text is displayed.