• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form Reset

 
Luv Bhatia
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Struts for my application and have a simple form for user information.AfterI submiting this form,when i come back to the same page, all form elements are filled with previously submiteed value.It seems that the form is not refereshing its value.
Any Advice,
Thanx
 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what scope are you putting the form in? session? If you keep the form in the session those values will be persisted as long as the user is logged in. Try putting it in the request. In your action mapping, just put scope="request".
If that doesnt solve it then can you provide more details and we can see what the problem is?
Dave
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34695
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need the form in the session, you can write a reset method in the form that resets all the values to null/empty.
 
Anand Gondhiya
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave ,
in Action Mapping scope is request. still it doesn't reset the form

Jeanne,
I already have javascript function "resetForm()" which would reset the form values to null (or default)


i.e I have two methods
1.overridden reset() in subclass of ActionForm
2.resetForm() function in javascript

the my goal is still not accomplished !!

waiting for replies
thank you in advance
-Anand.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34695
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anand,
Are you using the browser's back button by any chance? If so, the values are cached on the browser and the request is never hitting the server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic