mercredi 2 mai 2018

HTML5 input pattern validate letters and numbers

I need to validate password with these requirements:

At least 1 Letter, At least 1 Number, Min 6 chars and Max 12 chars, Special characters not allowed. Here's what I have so far.

<form>
Password: <input type="password" name="pw" pattern="^(?=.*[a-zA-Z])(?=.*[0-9]).{6,12}$" title="Must contain at least one number and one letter, and at least 6 to 12 characters (special characters not allowed)">
<input type="submit">
</form>

Aucun commentaire:

Enregistrer un commentaire