Field verification script help

Hello phphelp.com community

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.

With just quickly glancing over your code it looks like to me that you’re mixing JavaScript and PHP code up.

Well yes… I need someone to add up some lines as for the verification will be for starting with 3-digit number.

Or I need a different procedure to make that happen.

Need: Verification for minimum 6 digits and to begin with a 3-digit number.

Thanks.

Well, not sure about javascript, but in php, you’d do it with preg_match() and strlen(). I don’t know what the pattern would be though.

Sponsor our Newsletter | Privacy Policy | Terms of Service