views:

2566

answers:

4
+1  A: 

I've solved it!

This page on the Dojo forum was helpful.

I changed the HTML for the confirm password to:

<p>Confirm: <input type="password"
name="password2"
id="password2"
dojoType="dijit.form.ValidationTextBox"
required="true"
validator="return theSame(this, dijit.byId('password1'));"
invalidMessage="This password doesn't match your first password" /
></p>

The only difference is the added validator parameter.

And I created the following JavaScript function:

function(dojoTxt1, dojoTxt2) {
return dojoTxt1.getValue() == dojoTxt2.getValue();
}

I think you can also use the validator parameter to create regular expressions to test against, but the documentation isn't very clear.

Richard
I think that Ed's solution takes into account multiple constraints and is a more complete solution to the question.
Tony Lenzi
You're right. I just hadn't got round to looking because I'd solved the problem enough for my needs when he answered it.
Richard
+3  A: 
Ed
A: 

Is there any way to do this from the programmatic (Zend Framework) approach?

jessica
You should probably ask this as a new question and add some more detail about what you mean.
Richard
+1  A: 

Even easier, use the pre-written Dojox widget, dojox.form.PasswordValidator.

http://docs.dojocampus.org/dojox/form/PasswordValidator

It does everything you want straight out of the box!

voidstate