Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Problem Resetting Fields

 
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
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
He baked a muffin that stole my car! And this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic