You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Caroline Jen <ji...@yahoo.com> on 2004/09/10 19:10:24 UTC

How To Validate Any Three out of the Five Text Fields Are Required?

I have used the validation.xml to validate some
individual properties and been quite happy with the
feature.

Now, I have a form with five text fields.  If any
three out of those five fields are filled out, it
passes the submit validation check.

Is there any way to set 'required' for this kind of validation?


		
_______________________________
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool

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


Re: How To Validate Any Three out of the Five Text Fields Are Required?

Posted by João Vieira da Luz <Jo...@gmail.com>.
Maybe you could do your ActionForm and override validate method... 

This method could test if the validation is to be passed or not. If it
is to do validation you can rely on validation.xml.




On Fri, 10 Sep 2004 13:43:03 -0500, Matt Bathje <mp...@ntsource.com> wrote:
> You could probably use requiredif or validwhen to do this, but I think
> it would be extremely messy. I'm not aware of another built in validator
> that could handle this situation. You will probalby have to make your
> own unless somebody else has a better idea.
> 
> Matt
> 
> 
> 
> Caroline Jen wrote:
> > I have used the validation.xml to validate some
> > individual properties and been quite happy with the
> > feature.
> >
> > Now, I have a form with five text fields.  If any
> > three out of those five fields are filled out, it
> > passes the submit validation check.
> >
> > Is there any way to set 'required' for this kind of validation?
> >
> >
> >
> > _______________________________
> > Do you Yahoo!?
> > Shop for Back-to-School deals on Yahoo! Shopping.
> > http://shopping.yahoo.com/backtoschool
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: How To Validate Any Three out of the Five Text Fields Are Required?

Posted by Matt Bathje <mp...@ntsource.com>.
You could probably use requiredif or validwhen to do this, but I think 
it would be extremely messy. I'm not aware of another built in validator 
that could handle this situation. You will probalby have to make your 
own unless somebody else has a better idea.

Matt

Caroline Jen wrote:
> I have used the validation.xml to validate some
> individual properties and been quite happy with the
> feature.
> 
> Now, I have a form with five text fields.  If any
> three out of those five fields are filled out, it
> passes the submit validation check.
> 
> Is there any way to set 'required' for this kind of validation?
> 
> 
> 		
> _______________________________
> Do you Yahoo!?
> Shop for Back-to-School deals on Yahoo! Shopping.
> http://shopping.yahoo.com/backtoschool
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


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