You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Frederic Dernbach <fr...@free.fr> on 2003/10/01 11:13:17 UTC

Cannot create a DynaValidatorForm

Hello,

I cannot get the DynaValidatorForm to work. It does not do anything.

In struts-config.xml, I declared the form bean as :
<form-bean
	name="strategyListForm"
	type="org.apache.struts.validator.DynaValidatorForm">
	<form-property
		name="itemCount"
		type="java.lang.Integer"
		initial="5"/>
</form-bean>

In struts-config.xml, I added the action :
<action path="/StrategyList"
	type="com.rubis.web.system.StrategyListAction"
	scope="request"
	validate="true"
	name="strategyListForm"
	attribute="strategyListForm"
	parameter="reqCode">
	<forward name="success" 		path="/strategy/strategyList.jsp" />
</action>

In struts-config.wml, I added the required plug-in :
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
	<set-property
		property="pathnames"
		value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
JBoss tells me it loaded both validation-rules.xml and validation.xml
files.

In validation.xml I added the following :
<form-validation>
<formset>
	<form name="strategyListForm">
		<field
			property="itemCount"
			depends="required, integer">
			<arg0 key="rubis.common.fieldname.itemcount"/>
		</field>
				
	</form>

</formset>
</form-validation>


But no error is triggered if I input let's say a string for my itemCOunt
field. It looks like to validation happens.

Any idea ??

Fred


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


Re: Cannot create a DynaValidatorForm

Posted by Frederic Dernbach <fr...@free.fr>.
Thanks Adam,

This was the problem. Integer fields always exist.

It works fine now.


Le mer 01/10/2003 à 13:00, Adam Hardy a écrit :
> Hi Fred,
> what happens if you set the field type to String? If that fails 
> validation for an integer when you enter non-integer text, it will prove 
> that the validator is being invoked and you can go on from there.
> 
> 
> Adam
> 
> On 10/01/2003 11:13 AM Frederic Dernbach wrote:
> > Hello,
> > 
> > I cannot get the DynaValidatorForm to work. It does not do anything.
> > 
> > In struts-config.xml, I declared the form bean as :
> > <form-bean
> > 	name="strategyListForm"
> > 	type="org.apache.struts.validator.DynaValidatorForm">
> > 	<form-property
> > 		name="itemCount"
> > 		type="java.lang.Integer"
> > 		initial="5"/>
> > </form-bean>
> > 
> > In struts-config.xml, I added the action :
> > <action path="/StrategyList"
> > 	type="com.rubis.web.system.StrategyListAction"
> > 	scope="request"
> > 	validate="true"
> > 	name="strategyListForm"
> > 	attribute="strategyListForm"
> > 	parameter="reqCode">
> > 	<forward name="success" 		path="/strategy/strategyList.jsp" />
> > </action>
> > 
> > In struts-config.wml, I added the required plug-in :
> > <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> > 	<set-property
> > 		property="pathnames"
> > 		value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
> > </plug-in>
> > JBoss tells me it loaded both validation-rules.xml and validation.xml
> > files.
> > 
> > In validation.xml I added the following :
> > <form-validation>
> > <formset>
> > 	<form name="strategyListForm">
> > 		<field
> > 			property="itemCount"
> > 			depends="required, integer">
> > 			<arg0 key="rubis.common.fieldname.itemcount"/>
> > 		</field>
> > 				
> > 	</form>
> > 
> > </formset>
> > </form-validation>
> > 
> > 
> > But no error is triggered if I input let's say a string for my itemCOunt
> > field. It looks like to validation happens.
> > 
> > Any idea ??
> > 
> > Fred
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > 
> > 
> 
> -- 
> struts 1.1 + tomcat 5.0.12 + java 1.4.2
> Linux 2.4.20 RH9
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Cannot create a DynaValidatorForm

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi Fred,
what happens if you set the field type to String? If that fails 
validation for an integer when you enter non-integer text, it will prove 
that the validator is being invoked and you can go on from there.


Adam

On 10/01/2003 11:13 AM Frederic Dernbach wrote:
> Hello,
> 
> I cannot get the DynaValidatorForm to work. It does not do anything.
> 
> In struts-config.xml, I declared the form bean as :
> <form-bean
> 	name="strategyListForm"
> 	type="org.apache.struts.validator.DynaValidatorForm">
> 	<form-property
> 		name="itemCount"
> 		type="java.lang.Integer"
> 		initial="5"/>
> </form-bean>
> 
> In struts-config.xml, I added the action :
> <action path="/StrategyList"
> 	type="com.rubis.web.system.StrategyListAction"
> 	scope="request"
> 	validate="true"
> 	name="strategyListForm"
> 	attribute="strategyListForm"
> 	parameter="reqCode">
> 	<forward name="success" 		path="/strategy/strategyList.jsp" />
> </action>
> 
> In struts-config.wml, I added the required plug-in :
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> 	<set-property
> 		property="pathnames"
> 		value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
> </plug-in>
> JBoss tells me it loaded both validation-rules.xml and validation.xml
> files.
> 
> In validation.xml I added the following :
> <form-validation>
> <formset>
> 	<form name="strategyListForm">
> 		<field
> 			property="itemCount"
> 			depends="required, integer">
> 			<arg0 key="rubis.common.fieldname.itemcount"/>
> 		</field>
> 				
> 	</form>
> 
> </formset>
> </form-validation>
> 
> 
> But no error is triggered if I input let's say a string for my itemCOunt
> field. It looks like to validation happens.
> 
> Any idea ??
> 
> Fred
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


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


Re: Cannot create a DynaValidatorForm

Posted by Pratik Patel <pr...@ibiblio.org>.
> In validation.xml I added the following :
> <form-validation>
> <formset>
> 	<form name="strategyListForm">
> 		<field
> 			property="itemCount"
> 			depends="required, integer">
> 			<arg0 key="rubis.common.fieldname.itemcount"/>
> 		</field>
> 				
> 	</form>

First, don't put *anything* in the form when you submit it to see if the 
  "required" validator is working.

Second, remove the space here:
depends="required, integer">

i.e. make it:
depends="required,integer">


HTH,
Pratik



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