I am trying to create a form with the input type text box with two conditions.
1) validate empty field.
2) white space not allowed.
I have added pattern, everything is working fine when empty box, it says Please fill the empty field, and when user puts space in the username it says Please match the format requested, but the problem is that I am trying to replace default Please match the format requested with White space not allowed. But I am unable to find any solution anywhere.
My code is listed below:
<form method="post">
<input type="text" name="username" pattern="\S+" required >
</form>