Password checking in dojo

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2008-11-21T11:36:09Z Indexed on 2010/04/15 23:53 UTC
Read the original article Hit count: 271

Filed under:
|
|

I want to check that two passwords are the same using Dojo.

Here is the HTML I have:

<form id="form" action="." dojoType="dijit.form.Form" />

<p>Password: <input type="password"
name="password1"
id="password1"
dojoType="dijit.form.ValidationTextBox"
required="true"
invalidMessage="Please type a password" /
></p>

<p>Confirm: <input type="password"
name="password2"
id="password2"
dojoType="dijit.form.ValidationTextBox"
required="true"
invalidMessage="This password doesn't match your first password" /
></p>

<div dojoType="dijit.form.Button" onClick="onSave">Save</div>

</form>

Here is the JavaScript I have so far:

var onSave = function() {
if(dijit.byId('form').validate()) { alert('Good form'); }
else { alert('Bad form'); }
}

Thanks for your help. I could do this in pure JavaScript, but I'm trying to find the Dojo way of doing it.

© Stack Overflow or respective owner

Related posts about dojo

Related posts about JavaScript