Registration form - password / confirm password problem

2 replies · opened Aug 24, 2019

RrdetwilerAug 24, 2019

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>

SSemicolon WebSTAFFAug 25, 2019

Hello,

Unfortunately, this functionality is currently not built-in into Canvas. Consider using this example: https://jqueryvalidation.org/equalTo-method/ .

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

RrdetwilerAug 25, 2019

Got it. Thank you, I was able to get it to work.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard