
Originally Posted by
Hybrid
hi how do you create to fields in a form so that the check to make sure thier the same
Code:
function validate(form) {
var elem = form.elements;
if(elem.password.value != elem.confirm.value) {
alert('Please check your password; the confirmation entry does not match.);
return false;
}
return true;
}
HTML Code:
<form action="..." method="post" onsubmit="return validate(this);">
<!-- ... --->
<label>Password: <input name="password" type="password" value=""></label>
<label>Confirm password: <input name="confirm" type="password" value=""></label>
<!-- ... -->
</form>
couz i'm tryin to make a register form and i need and password and confirm password field.
Just make sure you check the values server-side!
Mike
Bookmarks