The clearing of a FORM requires a a call to the Document Object (DO) method, reset();. The problem is that the submission of a FORM does not leave many places or ways to do this. For example, we cannot put the reset call in the onsubmit Event Handler (EH) because this handler must be processed before the FORM is submitted. In fact, you cannot clear a FORM after submission anywhere within the FORM itself.
These special requirements pose a slight problem, but not one that cannot be overcome. The call to submit the FORM and then reset it, must come from outside the FORM, and any special FORM EH instructions previously executed, must now be executed outside the FORM, too. The main problem is to come up with a way to do this in a general sense, so that if we have 10 FORMs on our page we do not require 10 different ways to submit and then reset the forms...
The key to this (right-click, and <view source> to see what I did) is in two areas - the SubClear function, and the use of the onsubmit="return false;" EH. There are reasons why this is the way you have to handle it, but just do it like I did, and it will work. This is a modification of the simpall.html example.
Contact me concerning this article at
paypalhelper@aol.com.
Mention "clear FORM" in your note.
Individual help starting at $25.00 for simple JS solutions.