Hi Sashi,

Don't know if you've received any replies to this, but I initially handled it the same 
as you, but ran into problems when I was going back to the servlet for drop-down 
actions etc.   I only wanted validation errors to appear when the user hit the save 
button, so I ended up just checking for the save in the validation method as such:

//only validate form when a save has been pressed
        try {if (request.getParameter("saveBtn.x").equals(null)) return null;}
        catch (NullPointerException ex) {return null;}

I'm also interested in feed-back on my approach.


-----Original Message-----
From: Sashi Ravipati [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 1:19 PM
To: [EMAIL PROTECTED]
Subject: How to ignore validation when form loads (first time)


Hi

We have JSP pages which need user input. How can I display the form initially with out 
validation and then when user enters data and submits the page, the validation has to 
be done.

I tried to accomplish it by giving two <action> in Struts-Config.xml.  as shown below

eg:
<action path="/AddRate" type="xxxx.AddRateAction" name="addRateForm" 
input="AddRate.jsp" scope="request" validate="false" >
      <forward name="success" path="AddRate.jsp"/>
</action>
<action path="/Rate" type="xxxx.AddRateAction" name="addRateForm" input="AddRate.jsp" 
scope="request" validate="true" >
  <forward name="success" path="AddRate.do?target=create"/>
</action>

Not sure if this the way to do. Can somebody tell me if there is a better way to 
accomplish this.

Thanks

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

Reply via email to