[thelist] How do I clear form input fields onSubmit (or somehow)?

Theodore Serbinski need-4-speed-ski at erols.com
Wed Aug 2 10:02:36 CDT 2000


> So what I'd like to know is whether it's possible to clear the
> contents of those three fields at the time the form contents are sent
> without having to reload the parent page in the background. Ideally
> I'd like to just clear the contents, leaving the rest of the page
> alone.

Hey!

Actually it is quite easy to reset your form, just put the following code in
your onsubmit handler:

 document.yourFormName.reset();

And voila! Its all cleared.

However I think your best bet would be to take the user back to the previous
page after submitting form. If you think about, I go to this page, type all
my stuff in, hit submit and a little window pops up and than all of the
things I typed in are gone, I might get a little scared as to whether or not
my comments weren't sent in (despite the thank you window). If you could
find some way to just get rid of the form in all, that would probably be
best. And taking them back one page might even be better. And to go back in
javascript:

 history.go(-1);

hope something helps and if there is anything I left, feel free to comment
anyone.

-ted





More information about the thelist mailing list