struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Siggelkow <bills...@bellsouth.net>
Subject Re: Select Validation Rules based on context?
Date Mon, 26 Jul 2004 13:41:52 GMT
If you are using Struts 1.1 you may be able to use the "requiredIf" rule 
-- if you are using Struts 1.2 you can use the more powerful and easier 
to use "validWhen" rule. Details can be found at 
http://struts.apache.org/userGuide/dev_validator.html.

Christoph Kutzinski wrote:
> Hi,
> 
> I like to know if someone has successfully used the validation framework 
> to select rules based on a "free" context.
> My problem is this:
> 
> I have a registration wizard for a product that has different variants 
> (for individuals, for companies, ...)
> Now I want to reuse the wizard's JSPs, ActionForm, Action for the 
> different variants since they are 90% equal.
> However there are some differences (e.g. individual has a required field 
> Birthday while companies have not).
> How do I tell the validation framework to choose the validation rule for 
> birthday only if the variant is "indidual"?
> 
> BTW: While I could handle the situation above by filling birthday for 
> comapnies with a dummy value, it will fail if I have completely 
> differing validation rules for the different variants.
> E.g.: companies may choose a freely choosable email address while 
> individuals have to put a separator (dot) in the mail local part 
> (first.last@domain.com)
> 
> 
> thanx
> Christoph


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message