Is there a way to display a red border around required fields in AngularJS forms? I am populating the form from JSON data where a field is marked as "required" : true. These required fields need to be filled out by the user. How can I implement a red border to indicate that these fields are mandatory?
Below is a snippet of my code:
"First Name": {
"value": "naveen",
"type": "FIELD",
"editable": true,
"dataType": "",
"required":true
},
"Last Name": {
"value": "",
"type": "FIELD",
"editable": true,
"dataType": "",
"required":true
}
Both First Name and Last Name are marked as required.
/* Add your custom CSS here */
.error {
corder: 1px solid red;
}
I would like to apply this CSS class to the field on a button click if any of the required fields are left empty.
View the full code example here.
How can I modify the form to show red borders around invalid or incomplete fields?