Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get reset to work after form submit in JSP?

 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a web app where I submit a form in my jsp to a servlet . My form fields are reference through a bean ie . of the forn

Now I persist the value of the entered fields in the bean through request, However when i try to reset the page using a reset button, it doesnt work...
I know that the page is reloaded with the values that correspond to "bean.textfield" but is there a workaround to clear the form after submission??
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved it using a manual clear() function in JS , open to better solutions though..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot do anything to the form after submission. Submitting the page makes it simply go away.

If you are then displaying the same page, it's another page completely and you need to deal with it as such.

So the question comes down to: if you don't want the fields to have initial values, why are you putting them there in the first place?
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying Bear!
Well the initial values were preloaded in the request . So I had to explicitly clear the values of each of the text fields.
Dont know whether this was the right approach.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic