Edit the text field and it will get/lose classes according to the status.
Note: A text field with the "required" attribute is not valid when it is empty.