File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Help reset/clear form data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help reset/clear form data" Watch "Help reset/clear form data" New topic

Help reset/clear form data

Manuel Zammarono

Joined: Jun 28, 2011
Posts: 1
I am newbie in JSP and I am having trouble with resetting or clearing data in form. Assuming I have 2 simple jsp pages, namely first.jsp and second.jsp

That's the sample of my codes for the reset button and submit button. I would like to key in some data in form(first.jsp) and foward/display it into another jsp(second.jsp) which I put edit button to go back for the editting process(go back to first.jsp). Supposely when I not key in any data, and press Submit button I will get something like in attachment help1.PNG which is most of them is null. When I key in data I will get something like in attachment help2.PNG.

When I want to edit(I pressed edit at second.jsp) and it does bring me back to first.jsp and it have all the data which I key-in earlier.

Now the problem is, when I click reset button(first.jsp) it does clear all the forms. But when I pressed sumbit button after pressing reset button, it still foward all the values which I key-in earlier. And I get something like in attachment help2.PNG even I did not key-in any data at all.

So what should I do to reset all values back to null/initial when Reset button is pressed.. I tried using javascript or some onclick methods but none work so far.

p/s: Sorry for my bad english..

[Thumbnail for help1.PNG]

[Thumbnail for help2.PNG]

I agree. Here's the link:
subject: Help reset/clear form data
It's not a secret anymore!