JavaScript for Form (using CGI formmail) that sends user a copy ofthe form data

T

TPK

I have a form that collects field data, validates the data and sends
it (on submit) to a specific email address and to a text file. This is
done through a CGI form mail program. The form works well for this,
but I’d like to add some functionality using JavaScript.

The functionality I’d like to have is:
When the form submits, and email is sent to the specific email, I’d
also like the same email sent to the person submitting the form.

One of the fields on the form contains the email address of the person
filling out the form(senderEmail).
I’d like to have the value of that field (the sender’s email address)
incorporated in the onClick event so that when the user/sender clicks
the submit button the action that takes place sends e-mail to:
1) the “recipient”
2) the text file
3) the “sender”

Here is a shortened version of the form:

<form action="/cgi-bin/formmail.pl" name="MyForm" method="POST">
<input type="hidden" name="recipient" value="(e-mail address removed)">
<input type="Text" name="senderName">
<input type="text" name="senderEmaill" >
<input type="submit" value="submit" onClick="onClick();return true;">
<input type="reset" value="reset" name="reset">
</form>

Can someone show me a Javascript I can use (and how to use it in the
form) that would accomplish this?

Thank You,
TPK
 
T

Tim Slattery

TPK said:
I have a form that collects field data, validates the data and sends
it (on submit) to a specific email address and to a text file. This is
done through a CGI form mail program. The form works well for this,
but I’d like to add some functionality using JavaScript.

The functionality I’d like to have is:
When the form submits, and email is sent to the specific email, I’d
also like the same email sent to the person submitting the form.

One of the fields on the form contains the email address of the person
filling out the form(senderEmail).
I’d like to have the value of that field (the sender’s email address)
incorporated in the onClick event so that when the user/sender clicks
the submit button the action that takes place sends e-mail to:
1) the “recipient”
2) the text file
3) the “sender”

Here is a shortened version of the form:

<form action="/cgi-bin/formmail.pl" name="MyForm" method="POST">
<input type="hidden" name="recipient" value="(e-mail address removed)">
<input type="Text" name="senderName">
<input type="text" name="senderEmaill" >
<input type="submit" value="submit" onClick="onClick();return true;">
<input type="reset" value="reset" name="reset">
</form>

Can someone show me a Javascript I can use (and how to use it in the
form) that would accomplish this?

You won't find any way to do this client side. You'll have to do it
server-side. If you have access to the CGI program, making it send
this additional email should be easy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top