struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anjib Mulepati <anji...@hotmail.com>
Subject Re: Form data lost [S 1.3.8]
Date Tue, 31 Jul 2012 20:12:19 GMT
I mean when form data are invalid, user get the message on top of the 
form but all data in filed get lost. It shows blank form with error 
message. i want to show previously entered data so that user can correct 
only invalid field.

On 7/31/2012 3:09 PM, Martin Gainty wrote:
> could you define your intentions..?
>
> when form validation fails you want to save the data?
> what happens when form validation succeeds..do you invalidate the session?
>
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene 
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede 
> unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. 
> Diese Nachricht dient lediglich dem Austausch von Informationen und 
> entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten 
> Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den 
> Inhalt uebernehmen.
>
>
>
> > Date: Tue, 31 Jul 2012 12:09:07 -0400
> > From: anjibcs@hotmail.com
> > To: user@struts.apache.org
> > Subject: Form data lost [S 1.3.8]
> >
> > Hi All,
> >
> > I am using large form to input data. I have some validation code as 
> well
> > as I have condition where if something goes wrong in execution of 
> action
> > it will take the user back to the form.
> > My problem is when validation fail or form returned from action
> > execution all my form data are lost. How can I have form retain its 
> data
> > even after fail?
> > I am using struts tag for form and session scope for form.
> >
> > <html:form styleId="createAgentForm" action="createAgent"
> > focus="agentVersion">
> >
> > <label for="agentVersion" class="formLabel"><bean:message
> > key="label.agentVersion" />*</label>
> > <html:text property="agentVersion" size="10"
> > styleId="agentVersion" tabindex="1" titleKey="title.agentVersion"
> > value="" />
> > <br />
> >
> > ........
> >
> > <html:submit styleClass="submitbutton" tabindex="11"
> > value="Create Agent" title="Create Agent" />
> >
> > </html:form>
> >
> >
> > <action path="/createAgent"
> > type="com.anjib.actions.agencyadmin.CreateAgentAction"
> > input="/showCreateAgent.do"
> > name="CreateAgentForm"
> > scope="session" >
> > <forward name="createAgentForm" path="/showCreateAgent.do"/>
> > </action>
> >
> >
> > <action path="/showCreateAgent"
> > type="com.anjib.actions.agencyadmin.ShowCreateAgentAction">
> > <forward name="success" path="createAgentPage"/>
> > </action>
> >
> >
> > public class CreateAgentForm extends 
> org.apache.struts.action.ActionForm {
> > ..............................
> >
> > public ActionErrors validate(ActionMapping mapping,
> > HttpServletRequest request) {
> > ActionErrors errors = new ActionErrors();
> > if (getAgentName() == null || getAgentName().length() < 1) {
> > errors.add("createAgent", new
> > ActionMessage("error.agentName.required"));
> > }
> > .................................................
> > return errors;
> > }
> > }
> >
> > Thanks,
> > Anjib
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message