Hi all, I've been trying to implement the onblur function for a database, but i'm having trouble getting it to work. It's suppoed to be used for my 2nd password field to check it.
Would anyone be able to help me implement into the following code I have?:
script type="text/javascript">
function clear2(pass)
{
var x = document.getElementById(pass);
x.value = "";
}
<!--I used pwdCheck because it will make sure that the values are correctly input, or that there is no missing field so that the database will not have an empty row if customer forgets to put one-->
function pwdCheck1()
{
pwd1 = document.getElementById('password1').value;
pwd2 = document.getElementById('password2').value;
name = document.getElementById('name').value;
email = document.getElementById('email').value;
if(pwd1 == pwd2 && pwd1!="" && pwd2!="" && name!="" && email!="")
{
document.getElementById("checkpwdForm1").style.display = 'none';
document.form1.submit();
return true;
}
else
{
clear2('password1');
clear2('password2');
document.getElementById("checkpwdForm1").style.display = 'block';
return false;
}
}
function pwdCheck2()
{
xpwd1 = document.getElementById('xpassword1').value;
xpwd2 = document.getElementById('xpassword2').value;
xname = document.getElementById('xname').value;
xemail = document.getElementById('xemail').value;
xaddress = document.getElementById('xaddress').value;
<!---checks to see if passwords are equal and if all fields are filled in--->
if(xpwd1 == xpwd2 && xpwd1!="" && xpwd2!="" && xname!="" && xemail!="" && xaddress!="")
{
document.getElementById("checkpwdForm2").style.display = 'none';
document.form2.submit();
return true;
}
else
{
clear2('xpassword1')
clear2('xpassword2')
document.getElementById("checkpwdForm2").style.display = 'block';
return false;
}
}
</script>