You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Power <sp...@jacqueswhitford.com> on 2003/03/03 19:35:49 UTC

need help validating two forms either field 1 must be filled or field 2 must be filled.

Hey guys, 

I am just learning my way around struts and I need some help validating
a form.  I have used validation before and I know how to do it for a
single field and multiple fields. 

But now I am stuck, I have a form with two text fields for data to be
entered and I want to validate them.  I want the user to either enter
data into the first text or the second or both.  I just can't have both
fields empty. does anybody know how to do this? 

Thanks for any help that can be provided.

Scott Power

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


Re: need help validating two forms either field 1 must be filled or field 2 must be filled.

Posted by Jeff Kyser <kt...@comcast.net>.
How 'bout a requiredif rule for each field, where a value is
required if the other field's value is null?

See the stuff on the requiredif rule in the validator section
of the user guide (online at the struts web pages).

There's also been some recent discussion related to this - you
coud probably search the archives using my name :)

-jeff

On Monday, March 3, 2003, at 12:35  PM, Scott Power wrote:

> Hey guys,
>
> I am just learning my way around struts and I need some help validating
> a form.  I have used validation before and I know how to do it for a
> single field and multiple fields.
>
> But now I am stuck, I have a form with two text fields for data to be
> entered and I want to validate them.  I want the user to either enter
> data into the first text or the second or both.  I just can't have both
> fields empty. does anybody know how to do this?
>
> Thanks for any help that can be provided.
>
> Scott Power
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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