Welcome to WebmasterWorld Guest from 54.211.101.8

Forum Moderators: open

Help with a validation function?

   
10:23 pm on Mar 15, 2008 (gmt 0)

5+ Year Member



Keeps failing - any suggestions?


function checkpass(field1,field2,alerttxt)
{
with (field1,field2)
{
if (Pass1.value != Pass2.value)
{alert(alerttxt);return false}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{

if (checkpass(Pass1,Pass2,"Passwords do not match!")==false)
{Pass1.focus();return false}
}
}

1:03 am on Mar 16, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



function checkpass(Pass1,Pass2,alerttxt)
{
if (Pass1.value != Pass2.value)
{alert(alerttxt);return false}
else {return true}
}

Perhaps ?

In any case do away with the "with" statement

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month