aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Problem Resetting Fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem Resetting Fields" Watch "Problem Resetting Fields" New topic
Author

Problem Resetting Fields

Adam Zedan
Ranch Hand

Joined: Jun 10, 2011
Posts: 124

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

Don’t look where you fall, but where you slipped
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

A reset button shouldn't submit the form. Please include a SSCCE that demonstrates the issue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Adam Zedan
Ranch Hand

Joined: Jun 10, 2011
Posts: 124

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

Joined: Jan 10, 2002
Posts: 61433
    
  67

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

Joined: Jun 10, 2011
Posts: 124

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

Joined: Jan 10, 2002
Posts: 61433
    
  67

In my opinion, letting a tool like Dreamweaver generate code for you is a bad mistake. Hand code always.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem Resetting Fields