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

Simon sentient at mail.com
Wed Aug 2 09:36:49 CDT 2000


Hello all,

I have a comment card form that uses a CGI to send me the comments 
someone enters plus their email address and name. The form tag also 
uses onSubmit to do a window.open so that the "thank you for sending 
us your contents" page can open in a small popup window which the 
visitor can close to be right back where they started (no need to hit 
their back button or click any link to get there).

All of that works perfectly. The problem is that about 10% of the 
visitors click the "send" button again once they close the little 
popup window (that just told them their comment was sent and to 
expect a reply within 24 hours). In fact half of those 10% click that 
button three of more times even though the "your message was sent" 
popup opens and has to be closed again each time.

The problem seems to be that the three fields (name, email and 
comments) on the comment card on the main page still contain the 
information they entered. Some newer users seem to think their 
comments must not have been sent so they click the button again. The 
popup opens, they close it, see their comments still there and click 
the send button again. Sometimes they do this 10 times.

I'm sure this is frustrating to new users or anyone else who, for 
whatever reason, wind up believing their comments are not being sent. 
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.

I'll put a copy of the relevant code I'm using below (I can't point 
you to the actual pages). Only the domain info has been changed. If 
anyone can suggest a way to do this, or even a way to do what I want 
a different way, it would be most appreciated.

Simon

----- copy of comment card code now being used:

(Note - wrapped to aid readability only;
         only non-critical code stripped)

<form method=post
   action="http://www.NoRealDomain.not/cgi-bin/formmail.pl"
    target="sending"
     onsubmit="window.open('http://www.NoRealDomain.not/comments2.shtml',
      'sending','toolbar=0,width=350,height=200,directories=0,
       scrollbars=0,status=0,resize=0,menubar=0,
       screenX=150,scereenY=150,left=150,top=150')">
<input type=hidden name="redirect"
     value="http://www.NoRealDomain.not/comments2.shtml">
<input type=text name="name" size=16>
<input type=text name="email" size=16>
<textarea name="comment" rows=3 cols=40 wrap=virtual></textarea>
<input type=image src="send.gif" alt="send" border=0>
</form>

----- end copy of comment card code -----

Sentient Technologies
mailto:Sentient at mm0.net




More information about the thelist mailing list