Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem Resetting Fields

 
Adam Zedan
Ranch Hand
Posts: 124
C++ Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , i wanted to reset the fields (2 textboxes) on my jsp page. I thought that using the reset HTML button would do the trick but that doesn't work
I am currently using the following code inside my form


When i click on this button the form does clear the textboxes and then goes to the dopost method.
I thought that the HTML reset field doesn't do a post or get and simply resets all fields which are within the form it is present in..
Any suggestion on what could be going wrong.How can i just reset the fields without getting it to do a form post action
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A reset button shouldn't submit the form. Please include a SSCCE that demonstrates the issue.
 
Adam Zedan
Ranch Hand
Posts: 124
C++ Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:A reset button shouldn't submit the form. Please include a SSCCE that demonstrates the issue.




The bold part is the reset button and when clicked it does clear the text fields and then posts the form!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't try to bold code -- as you can see it doesn't work and just makes the code harder to cut and paste.

Why do you have the buttons inside a label? That's not valid HTML and for some reason, that causes some browsers to act incorrectly.

Also, never name anything "Submit" or "submit". That's just asking for trouble.
 
Adam Zedan
Ranch Hand
Posts: 124
C++ Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah removing the reset button from the label solved the problem. Thanks for pointing that out. This just shows that you cant really rely on dream weaver all the time. My bad though I should have caught that mistake.. Thanks for pointing that out.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion, letting a tool like Dreamweaver generate code for you is a bad mistake. Hand code always.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic