Re: [Rife-users] Conditional constraints
Okidoki, good that you got it working as wanted :-) Eddy Young wrote: On 30 Jan 2006, at 22:28, Geert Bevin wrote: 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? Note to self: be more specific :-) It's not that it did not work, but it did not have the expected behaviour. After posting this, I realised that I could simply call addConstraint in the submission handler method, which I did with success. Thanks for the prompt reply anyway. 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 comTel +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
Re: [Rife-users] Conditional constraints
On 30 Jan 2006, at 22:28, Geert Bevin wrote: 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? Note to self: be more specific :-) It's not that it did not work, but it did not have the expected behaviour. After posting this, I realised that I could simply call addConstraint in the submission handler method, which I did with success. Thanks for the prompt reply anyway. Eddy ___ Rife-users mailing list Rife-users@uwyn.com http://lists.uwyn.com/mailman/listinfo/rife-users
Re: [Rife-users] Conditional constraints
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 comTel +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