Here's how auth.register() does it (slightly edited):
requires=IS_EXPR('value==%s' % repr(request.vars.get('password', None)),
error_message="Password fields don't match")
Anthony
On Tuesday, March 27, 2012 5:40:29 PM UTC-4, cyan wrote:
>
>
> Hi group,
>
> How do I enforce some simple validation for passwords matching on a form
> in a controller? All I want to do is to check the second password is the
> same as the first one, and here is some code I've come up so far:
>
> form = SQLFORM.factory(
> Field('email', requires=IS_NOT_EMPTY()),
> Field('pwd', requires=[IS_NOT_EMPTY(), IS_STRONG(min=6, special=0, upper=
> 1), CRYPT()]),
> Field('re_pwd', requires=IS_MATCH(???)))
>
> I am attempting to use the validator 'IS_MATCH()' for the second password,
> but not sure how I reference the the input in the first password field of
> the same form. Any suggestion would be welcome. Thanks.
>