Hi Eddy,

you can freely declare your constraints at any time, of course you have to do so at the proper time for your use-case. It might be that activateValidation is called before you set the properties and thus the wrong condition is used. Btw, what do you mean with "this did not work". What exactly didn't work?

Best regards,

Geert

Eddy Young wrote:
Hi,

I want to add some constraints to a bean based on the presence of a given value (e.g. password change in an "update profile" page where the constraints are applicable only if there is a value in the first password field). I've already tried putting a condition in activateValidation(), but I'm not sure if this is the correct place for that.

if (getPassword1() != null && getPassword().trim().length() > 0)
    addConstraint(new ConstrainedProperty("password2").notNull(true).
        notEmpty(true));


That did not work.

Thanks,

Eddy
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin                       Uwyn bvba
"Use what you need"               Avenue de Scailmont 34
http://www.uwyn.com               7170 Manage, Belgium
gbevin[remove] at uwyn dot com    Tel +32 64 84 80 03

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to