More often than not, forms and form fields are coupled with form field validations that validate the text inside the field and show an error if the validation failed.
Here is the simple code for the same.

Here is what this looks like

View source code here: Link