This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

How to reset form

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fellas

I am using the normal ActionForm class.

This is the design flow of how it is setup.

There is a link on the homepage. When this link is clicked, the POPULATE_FORM_ACTION class is called which prepopulates the drop down menus etc of the form.

Now this form has two buttons, the submit and the reset. When I click the reset button, I want the same action class (POPULATE_FORM_ACTION) to be called which will show the form with default values and all the values entered by the user should be cleared.

But I am not able to do this. The values entered by the user are not cleared.

I was told to change the scope to request - but it has to be session for this project. I have a reset method in which i initialize all fields to null. But that doesnt help either.

I am sure its a very simple problem cos every form does have a submit and reset functionality - but I dont know why i'm having problems

Thanks
gublooo
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using <html:reset ... /> for the reset button? I know that is usually my problem when buttons are not working as expected.
 
Gilbert johnson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I tried html:reset button but the weird thing is nothing happens when u click on that button . I mean even the page does not get submitted and the button is inside the form tag - so i'm not sure why that happens....

Gublooo
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't want html:reset for what you're doing. html:reset won't submit the form because it performs a browser functionality of resetting values to what they loaded as. You need a regular old submit button.
 
That is a really big piece of pie for such a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!