Hi all,

I'm learning validator framework in struts 1.3.5. My first page contains a
required field and 
now I'm facing a problem. Before the page is rendered, it fails to pass the 
validation so it always displays an error message. How to tell struts 1 to 
give user a chance to input data before it does validation?

I tried using onsubmit handler in the <html:form...> tag but it doesn't
solve 
the issue.

Thanks.

== login.jsp ==
<html:form action="/login">
        <html:text property="userName"/><html:errors property="userName"/><br/>
        <html:submit value="Submit"/>
</html:form>

== struts-config.xml ==
<action-mappings>
        <action path="/login" name="loginForm" 
        input="/login.jsp" type="com.test.LoginAction">
                <forward name="success" path="/login.jsp"/>
        </action>
</action-mappings>

<!--
        if not using org.apache.struts.action.MESSAGEas the key, an Exception 
will 
        be thrown. Don't know why???
-->
<message-resources key="org.apache.struts.action.MESSAGE"
parameter="errorMessages"/>

== validation.xml ==
<form-validation>
   <formset>
      <form name="loginForm">
         <field property="userName" depends="required">
        <msg name="required" key="error.user.name"/>
         </field>
      </form>
   </formset>
</form-validation>
-- 
View this message in context: 
http://www.nabble.com/struts-1.3.5%3A-hwo-to-let-user-input-before-the-validation-tp20474332p20474332.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to