password validation (minimum # of characters and alphanumeric only)
Posted on 2004-10-14
Can you help. I have a password input text field ... (see below)
<input name="register_password" type="password" size="15" maxlength="20" onfocus="change2Msg(3);">
I need to build some validation into it ... to ONLY access alphanumeric characters A-Z a-z 0-9 with NO spaces nor other characters AND the password MUST be between 6 and 20 characters in length.
I'm don't want a pop up message ... I'm actually hoping to restrict the input of the password's unacceptable characters DURING input using something LIKE onkeyup='this.value=this.value.replace(blah);' where the blah is the stuff I don't understand and need your help with! ...
SO to confirm ...
if I enter / click / tab into the password input field 'register_password' and I only input 4 characters ... I'm forced to stay in the input field until I enter at least 6 and no more than 20 ... AND those characters accepted are only alphanumeric.
Does this make sense? I know it's fussy but it's for a very specific need.