You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2006/07/03 16:03:49 UTC

Form validation not happening

Hello there! I'm trying to use form validation (It was working, but
somehow, I messed something and it quit working). Here are my files:

struts-config.xml
 <form-beans>
		<form-bean name="userForm" type="com.acme.UserForm"></form-bean>
    </form-beans>

 <action path="/register" scope="request" validate="true"
type="com.acme.RegisterAction"  name="userForm"
input="/registerScreen.do">

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">

    <set-property
        property="pathnames"
        value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
  </plug-in>

<form name="userForm">
   			<field property="name" depends="required">
	   			<msg name="required" key="error.nameRequired"/>
   			</field>
   			<field property="email" depends="required">
   				<msg name="required" key="error.emailRequired"/>
   			</field>
   		</form>

My UserForm extends ValidatorActionForm!

When the user submits, instead of returning to the input page and
display the errors he's redirect to the action that deals with the
register.

Any ideas?

Best regards

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


Re: Form validation not happening

Posted by Vinicius Carvalho <ja...@gmail.com>.
Nope. I'm using the default commons-validator and strus libs shipped
with 1.2.9. And sorry but did not understand your XYZ example ?????

Regards

On 7/3/06, Paul Benedict <pa...@yahoo.com> wrote:
> Make sure you're using the correct ValidatorXYZForm base class. ValidatorActionForm uses the key of the URI, ValidatorForm uses the key of the form name.
>
> Did you recently upgrade Struts or the Validator?
>
> Vinicius Carvalho <ja...@gmail.com> wrote: I did a deeper look on my project, enabled debug output and even
> though on the log it says that the requestprocessor is calling
> validate, my validate method on my class (gave up on validation using
> xml) does not even get called...
>
> Any ideas?
>
> Regards
>
> On 7/3/06, Vinicius Carvalho  wrote:
> > Hello there! I'm trying to use form validation (It was working, but
> > somehow, I messed something and it quit working). Here are my files:
> >
> > struts-config.xml
> >
> >
> >
> >
> >
> > type="com.acme.RegisterAction"  name="userForm"
> > input="/registerScreen.do">
> >
> >
>
> >
> >
> >         property="pathnames"
> >         value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
> >
> >
> >
>
> >
> >
> >
> >
> >
> >
> >
> >
> > My UserForm extends ValidatorActionForm!
> >
> > When the user submits, instead of returning to the input page and
> > display the errors he's redirect to the action that deals with the
> > register.
> >
> > Any ideas?
> >
> > Best regards
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------
> Sneak preview the  all-new Yahoo.com. It's not radically different. Just radically better.
>

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


Re: Form validation not happening

Posted by Paul Benedict <pa...@yahoo.com>.
Make sure you're using the correct ValidatorXYZForm base class. ValidatorActionForm uses the key of the URI, ValidatorForm uses the key of the form name.

Did you recently upgrade Struts or the Validator?

Vinicius Carvalho <ja...@gmail.com> wrote: I did a deeper look on my project, enabled debug output and even
though on the log it says that the requestprocessor is calling
validate, my validate method on my class (gave up on validation using
xml) does not even get called...

Any ideas?

Regards

On 7/3/06, Vinicius Carvalho  wrote:
> Hello there! I'm trying to use form validation (It was working, but
> somehow, I messed something and it quit working). Here are my files:
>
> struts-config.xml
>  
>                 
>     
>
>  
> type="com.acme.RegisterAction"  name="userForm"
> input="/registerScreen.do">
>
> 

>
>     
>         property="pathnames"
>         value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>   
>
> 

>                         
>                                 
>                         
>                         
>                                 
>                         
>                 
>
> My UserForm extends ValidatorActionForm!
>
> When the user submits, instead of returning to the input page and
> display the errors he's redirect to the action that deals with the
> register.
>
> Any ideas?
>
> Best regards
>

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



 			
---------------------------------
Sneak preview the  all-new Yahoo.com. It's not radically different. Just radically better. 

Re: Form validation not happening

Posted by Vinicius Carvalho <ja...@gmail.com>.
I did a deeper look on my project, enabled debug output and even
though on the log it says that the requestprocessor is calling
validate, my validate method on my class (gave up on validation using
xml) does not even get called...

Any ideas?

Regards

On 7/3/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> Hello there! I'm trying to use form validation (It was working, but
> somehow, I messed something and it quit working). Here are my files:
>
> struts-config.xml
>  <form-beans>
>                 <form-bean name="userForm" type="com.acme.UserForm"></form-bean>
>     </form-beans>
>
>  <action path="/register" scope="request" validate="true"
> type="com.acme.RegisterAction"  name="userForm"
> input="/registerScreen.do">
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>
>     <set-property
>         property="pathnames"
>         value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>   </plug-in>
>
> <form name="userForm">
>                         <field property="name" depends="required">
>                                 <msg name="required" key="error.nameRequired"/>
>                         </field>
>                         <field property="email" depends="required">
>                                 <msg name="required" key="error.emailRequired"/>
>                         </field>
>                 </form>
>
> My UserForm extends ValidatorActionForm!
>
> When the user submits, instead of returning to the input page and
> display the errors he's redirect to the action that deals with the
> register.
>
> Any ideas?
>
> Best regards
>

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