I am working on validating user input in a html form. I want the form to catch any blank spaces and a list of words not permitted.
<td><input type="text" name="Name" pattern="^[^\s]+$|cow|horse" required ></td>
The bit of pattern value "^[^\s]+$" seems to catch if any white spaces are in the input. However the following code does not catch/stop the form submission if cow or horse is entered. Can someone advice me on this please.
Aucun commentaire:
Enregistrer un commentaire