Re: Form data lost [S 1.3.8]
aren't default scope is session?? i am wondering if I am missing any other point other than scope. On 7/31/2012 6:20 PM, Paul Benedict wrote: I think you're losing the data because you're unintentionally creating a new form. Make sure both actions refer to the form with the same scope. On Tue, Jul 31, 2012 at 11:09 AM, Anjib Mulepati wrote: 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. * 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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Form data lost [S 1.3.8]
I think you're losing the data because you're unintentionally creating a new form. Make sure both actions refer to the form with the same scope. On Tue, Jul 31, 2012 at 11:09 AM, Anjib Mulepati wrote: > 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. > > focus="agentVersion"> > > key="label.agentVersion" />* > tabindex="1" titleKey="title.agentVersion" value="" /> > > > > > > > > > >type="com.anjib.actions.agencyadmin.CreateAgentAction" > input="/showCreateAgent.do" > name="CreateAgentForm" > scope="session" > > > > > > type="com.anjib.actions.agencyadmin.ShowCreateAgentAction"> > > > > > 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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Form data lost [S 1.3.8]
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: anji...@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. > > focus="agentVersion"> > > key="label.agentVersion" />* > styleId="agentVersion" tabindex="1" titleKey="title.agentVersion" > value="" /> > > > > > value="Create Agent" title="Create Agent" /> > > > > > type="com.anjib.actions.agencyadmin.CreateAgentAction" > input="/showCreateAgent.do" > name="CreateAgentForm" > scope="session" > > > > > > type="com.anjib.actions.agencyadmin.ShowCreateAgentAction"> > > > > > 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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >