Hi Canvas,
I'm running into an issue with the password / confirm password fields on the registration form.
There isn't any javascript in the page html that checks if the fields match, so I assume I need to add the javascript, right?
I've tried several different code snips, but non work with the fields.. the form submits regardless.. as if the javascript weren't even there.
Why is that? Am I missing something? Here is an example -- please point me in the right direction.
Thank you very much:
<div class='col_full'>
<label for='register-form-password'>Password:</label>
<input type='password' id='password' name='password' value='' class='form-control' />
</div>
<div class='col_full'>
<label for='register-form-repassword'>Confirm Password:</label>
<input type='password' id='password_confirm' name='password_confirm' value='' class='form-control' oninput='check(this)' />
</div>
<script language='javascript' type='text/javascript'>
function check(input) {
if (input.value != document.getElementById('password').value) {
input.setCustomValidity('Passwords must match');
} else {
// input is valid -- reset the error message
input.setCustomValidity('');
}
}
</script>
