Field verification script help

Hello again unix.com

I need some help regarding a script.

I have:

function checkform ( form )
{
       if (form.pass.value.length < 6) {
        alert( "Error." );
        form.pass.focus();
          document.getElementById('pass').style.backgroundColor="#FFFFFF";
        return false ;
      }
<form name="ModifierQuestRepAuthForteForm" method="post" action="servelet.php" onsubmit="return checkform(this);">

That is for password minimum 6 characters. I want also to verify the field as the password will begin with only 3 number.

Example: 123abc will work and abc123 wont.

Thanks in advance.

---------- Post updated at 12:00 PM ---------- Previous update was at 09:20 AM ----------

Can anyone help me with a script for a password field that verifies -> minimum 6 and begins with 3-digit number. thx

Not real good with JavaScript, but I'd probably try something like:

function checkform ( form )
{
       if (form.pass.value.length < 6 || !form.pass.value.match("^\\d{3}") ) {
        alert( "Error." );
        form.pass.focus();
          document.getElementById('pass').style.backgroundColor="#FFFFFF";
        return false ;
      }
<form name="ModifierQuestRepAuthForteForm" method="post" action="servelet.php" onsubmit="return checkform(this);">
1 Like

Working. Thanks alot sir.