You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Appel, Jeremy D" <je...@qwest.com> on 2003/06/03 23:58:44 UTC

Coarse-grained DynaValidatorForm

I have three separate Action Forms with two properties shared between them.
I am currently using the DynaValidatorForm and validation rules set up for
them.  I would like to migrate to one Form Bean but I am not quite sure how
to do this with DynaValidatorForm.  For example:

	Form 1:
		property name="distinct field1"
		property name="shared field1"
		property name="shared field2"

	Form 2:
		property name="distinct field2"
		property name="shared field1"
		property name="shared field2"

	Form 3:
		property name="distinct field3"
		property name="shared field1"
		property name="shared field2"

How I can tell DynaValidatorForm to always validate "shared field1" and
"shared field2" and do the following:

	Validate "distinct field1" when "distinct field2" and "distinct
field3" are null
	Validate "distinct field2" when "distinct field1" and "distinct
field3" are null
	Validate "distinct field3" when "distinct field1" and "distinct
field2" are null

Thanks in advance,
Jeremy Appel





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


Re: Coarse-grained DynaValidatorForm

Posted by Ted Husted <hu...@apache.org>.
The Struts Validator actually keys on the ActionMapping attribute. By 
default this is set to be the FormBean name, but you can set a different 
attribute on the ActionMapping.

So, on the ActionMapping, set a different attribute for each case, and 
then specify a corresponding validator form using the same token.

-Ted.

Appel, Jeremy D wrote:
> I have three separate Action Forms with two properties shared between them.
> I am currently using the DynaValidatorForm and validation rules set up for
> them.  I would like to migrate to one Form Bean but I am not quite sure how
> to do this with DynaValidatorForm.  For example:
> 
> 	Form 1:
> 		property name="distinct field1"
> 		property name="shared field1"
> 		property name="shared field2"
> 
> 	Form 2:
> 		property name="distinct field2"
> 		property name="shared field1"
> 		property name="shared field2"
> 
> 	Form 3:
> 		property name="distinct field3"
> 		property name="shared field1"
> 		property name="shared field2"
> 
> How I can tell DynaValidatorForm to always validate "shared field1" and
> "shared field2" and do the following:
> 
> 	Validate "distinct field1" when "distinct field2" and "distinct
> field3" are null
> 	Validate "distinct field2" when "distinct field1" and "distinct
> field3" are null
> 	Validate "distinct field3" when "distinct field1" and "distinct
> field2" are null
> 
> Thanks in advance,
> Jeremy Appel
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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