You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by pundarik rajkhowa <pu...@gmail.com> on 2010/03/24 07:15:49 UTC

Form values getting empty After validation failure

Hi,

I am using html file control to upload a file. If file size exceeds a limit,
then I return an error from Action class through ActionMessages object. The
errors are displayed fine.The problem is that the input form has around 10
fields and after I return control to it for file size limit error display,
all the form fields become empty. How do I retain the values in the form
fields, any idea ?

regards,
Pundarik

Re: Form values getting empty After validation failure

Posted by Greg Lindholm <gr...@gmail.com>.
Does this FAQ entry help?

http://struts.apache.org/2.x/docs/how-do-we-repopulate-controls-when-validation-fails.html

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


RE: Form values getting empty After validation failure

Posted by adam pinder <ap...@hotmail.co.uk>.
 
the selects should behave as any other input type, if the select name has an associated get in the action class then it should re-populate the selected value.
 
i use a straight <s:select ../> and its fine.
 
if that is all present...
 
turn on the debugging for the parameters interceptot and check the select name/value pair being sent to the action class and compare that with the select values in the html page and make sure the value sent does actually exist in the select options when re-rendered.


----------------------------------------
> Date: Thu, 25 Mar 2010 09:34:16 +0530
> Subject: Re: Form values getting empty After validation failure
> From: pundarickr@gmail.com
> To: user@struts.apache.org
>
> Hi Adam,
>
> You are right. The problem is fixed now. However I am facing a different
> issue now. I also have a couple of html select controls in the page. For
> them , how do I get the select state restored ? As of now , they take the
> default value even after making a different selection.
>
> regards,
> Pundarik
>
> On Wed, Mar 24, 2010 at 11:29 PM, adam pinder wrote:
>
>>
>>
>> as long as you are simply re-displaying the same form associated with the
>> same action it should work like any other page - the input fields are
>> struts2 tags and there are getters for each property in the action it should
>> retrieve the value and re-display them
>>
>> i have a similar thing and it works fine.
>>
>>
>>
>> ----------------------------------------
>>> Date: Wed, 24 Mar 2010 11:45:49 +0530
>>> Subject: Form values getting empty After validation failure
>>> From: pundarickr@gmail.com
>>> To: user@struts.apache.org
>>>
>>> Hi,
>>>
>>> I am using html file control to upload a file. If file size exceeds a
>> limit,
>>> then I return an error from Action class through ActionMessages object.
>> The
>>> errors are displayed fine.The problem is that the input form has around
>> 10
>>> fields and after I return control to it for file size limit error
>> display,
>>> all the form fields become empty. How do I retain the values in the form
>>> fields, any idea ?
>>>
>>> regards,
>>> Pundarik
>> _________________________________________________________________
>> Send us your Hotmail stories and be featured in our newsletter
>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>> 		 	   		  
_________________________________________________________________
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Form values getting empty After validation failure

Posted by pundarik rajkhowa <pu...@gmail.com>.
Hi Adam,

You are right. The problem is fixed now. However I am facing a different
issue now. I also have a couple of html select controls in the page. For
them , how do I get the select state restored ? As of now , they take the
default value even after making a different selection.

regards,
Pundarik

On Wed, Mar 24, 2010 at 11:29 PM, adam pinder <ap...@hotmail.co.uk> wrote:

>
>
> as long as you are simply re-displaying the same form associated with the
> same action it should work like any other page - the input fields are
> struts2 tags and there are getters for each property in the action it should
> retrieve the value and re-display them
>
> i have a similar thing and it works fine.
>
>
>
> ----------------------------------------
> > Date: Wed, 24 Mar 2010 11:45:49 +0530
> > Subject: Form values getting empty After validation failure
> > From: pundarickr@gmail.com
> > To: user@struts.apache.org
> >
> > Hi,
> >
> > I am using html file control to upload a file. If file size exceeds a
> limit,
> > then I return an error from Action class through ActionMessages object.
> The
> > errors are displayed fine.The problem is that the input form has around
> 10
> > fields and after I return control to it for file size limit error
> display,
> > all the form fields become empty. How do I retain the values in the form
> > fields, any idea ?
> >
> > regards,
> > Pundarik
> _________________________________________________________________
> Send us your Hotmail stories and be featured in our newsletter
> http://clk.atdmt.com/UKM/go/195013117/direct/01/
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Form values getting empty After validation failure

Posted by adam pinder <ap...@hotmail.co.uk>.
 
as long as you are simply re-displaying the same form associated with the same action it should work like any other page - the input fields are struts2 tags and there are getters for each property in the action it should retrieve the value and re-display them
 
i have a similar thing and it works fine.
 


----------------------------------------
> Date: Wed, 24 Mar 2010 11:45:49 +0530
> Subject: Form values getting empty After validation failure
> From: pundarickr@gmail.com
> To: user@struts.apache.org
>
> Hi,
>
> I am using html file control to upload a file. If file size exceeds a limit,
> then I return an error from Action class through ActionMessages object. The
> errors are displayed fine.The problem is that the input form has around 10
> fields and after I return control to it for file size limit error display,
> all the form fields become empty. How do I retain the values in the form
> fields, any idea ?
>
> regards,
> Pundarik 		 	   		  
_________________________________________________________________
Send us your Hotmail stories and be featured in our newsletter
http://clk.atdmt.com/UKM/go/195013117/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Form values getting empty After validation failure

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
Hi,

don't know if it will be usefull, but some days ago someone in the user 
list suggested using the getters and setters of the properties that map 
to your form to call get() and put() methods of the current session ( 
ActionContext.getContext().getSession() ) , so you get "automatic" 
session persistence of form values.

regards

Em 24-03-2010 06:15, pundarik rajkhowa escreveu:
> Hi,
>
> I am using html file control to upload a file. If file size exceeds a limit,
> then I return an error from Action class through ActionMessages object. The
> errors are displayed fine.The problem is that the input form has around 10
> fields and after I return control to it for file size limit error display,
> all the form fields become empty. How do I retain the values in the form
> fields, any idea ?
>
> regards,
> Pundarik
>


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