View Full Version : fill in text field twice to confirm
bsxiong
06-28-2007, 08:59 AM
how do make it so that the user have to enter their email twice in a form. Like their two email has to match up or else when hey submit, they get an error.
acslater323
06-28-2007, 01:15 PM
<script type="text/javascript">
function checkEmail() {
email = document.getElementById('email').value;
confirm_email = document.getElementById('confirm-email').value;
if(email == confirm_email) {
return true;
}
else {
alert("E-mails don't match");
return false;
}
}
</script>
<form action="" method="post" onsubmit="return checkEmail()">
<input type="text" name="email" id="email" />
<input type="text" name="confirm_e-mail" id="confirm-email" />
<input type="submit" />
</form>
bsxiong
06-28-2007, 02:17 PM
thanks, that worked perfectly!
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.