[Catalyst] HTML::Widget constraint for optional but equal fields?

Randall Hansen randall at raan.net
Mon Jan 30 15:55:27 CET 2006

Hi Folks ~

I'm trying to figure out an HTML::Widget constraint for two password
fields -- the fields are optional, but if one is filled they must both
be filled and equal.

My first thought was 'Equal', e.g.:

    $c->widget->constraint( 'Equal', 'password1', 'password2' );

This won't work because by design 'Equal' passes if one of the fields
is blank.

I haven't found another combination of constraints that will do what I
want.  At this point I'm left checking the fields explicitly in Perl,
and adding the error manually.  I suppose I could conditionally add a
constraint if a one of the password fields were present, but this
seems inelegant.  Is there a better way?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060130/6361fe9b/attachment.pgp

More information about the Catalyst mailing list