Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

forms

Status
Not open for further replies.

WannaLearn

Programmer
Jul 10, 2001
210
US
What i'm doing is having 4 forms on one page, 3 of the 4 forms have different e-mail addresses and some fields that need to be answered (the user chooses which form they are interested in filling out), then the 4th form has the contact info. Now is it possible to have any one of the first 3 forms that user inputted info. into AND the contact form to be emailed to the respective e-mail address?
This is the basic idea of what I am trying to accomplish:

<form name=&quot;1&quot; action=&quot;mail1@mail.com&quot; mrthod=&quot;post&quot;>
....
....
....
</form>

<form name=&quot;2&quot; action=&quot;mail2@mail.com&quot; mrthod=&quot;post&quot;>
....
....
....
</form>

<form name=&quot;3&quot; action=&quot;mail3@mail.com&quot; mrthod=&quot;post&quot;>
....
....
....
</form>

<form name=&quot;contactform&quot; action=&quot;&quot; mrthod=&quot;post&quot;>
....
....
....
</form>

So, if form name=&quot;1&quot; was filled out, and contactform was filled out, both forms would be e-mailed to email as indicated in form 1, is that doable in simple JS?
Thanks.
 

You can add an onSubmit action to the forms to change the action of the cintact form.

function changeAction(x){
document.forms(&quot;contactform&quot;).action = x.action;
document.forms(&quot;contactform&quot;).submit();
document.forms(x).submit();
return false;
}


<form name=&quot;1&quot; action=&quot;mail1@mail.com&quot; method=&quot;post&quot; onSubmit=&quot;return changeAction(this)&quot;>

Hope this helps

Simon
 
Hi, Simon. thanks for helping. But I am having some problems with your suggestion. This is a mock code of I have so far, how can I implement your idea into this?


<HTML>
<HEAD>

<script>
function goThere() {
if(document.form1.select1.options[0].selected == true) {
alert(&quot;Select Something&quot;);
return false;
}
else {
window.location.href=document.form1.select1.options[document.form1.select1.selectedIndex].value
}
}
</script>
</HEAD>

<BODY>
<CENTER>
<table width=&quot;700&quot; border=&quot;0&quot; align=&quot;center&quot;>
<tr valign=&quot;top&quot;>
<td>
<center>
<table cellpadding=&quot;2&quot; align=&quot;Center&quot;>
<tr valign=&quot;Top&quot;>
<td>
<form name=&quot;form1&quot;>
<select name=&quot;select1&quot;>
<option value=&quot;&quot;>Please Select One of the Following:</option>
<option value=&quot;#Section1&quot;>Section 1</option>
<option value=&quot;#Section2&quot;>Section 2</option>
<option value=&quot;#Section3&quot;>Section 3</option>
</select>
<input type=&quot;button&quot; value=&quot;Take me there&quot; onClick=&quot;return goThere();&quot;>
</form></td>
</tr>
</table>
</center>
<hr>
<table width=&quot;700&quot; align=&quot;center&quot;>
<tr>
<td>

FORM ONE:
<form method=&quot;GET&quot; action=&quot;/cgi-bin/misc/mailform.cgi&quot;>
<p align=Center>
<input type=hidden name=&quot;recipient&quot; value=&quot;mail1@isp.com&quot;>
<input type=hidden name=&quot;subject&quot; value=&quot;Section 1 info&quot;>
<input type=hidden name=&quot;required&quot; value=&quot;email&quot;>
<a name=&quot;Section1&quot;></a>
<table width=&quot;100%&quot; cellpadding=&quot;2&quot;>
<tr>
<td width=&quot;72%&quot;><font size=&quot;2&quot; color=&quot;#ff0000&quot;><b>SECTION
1 :</b></font><font size=&quot;2&quot; color=&quot;004080&quot;>  For this
area, please enter the requested information.</font></td>
<td width=&quot;28%&quot;> </td>
</tr>
</table>
<table width=&quot;100%&quot; cellpadding=&quot;2&quot;>
<tr valign=&quot;middle&quot;>
<td><font size=&quot;2&quot;><b>My question is: </b></font> <table width=&quot;90%&quot; cellpadding=&quot;2&quot;>
<tr valign=&quot;middle&quot;>
<td width=&quot;56%&quot;><textarea name=&quot;section 1 txt&quot; cols=&quot;30&quot;></textarea>
</td>
<td width=&quot;1%&quot;> </td>
<td width=&quot;32%&quot;><font size=&quot;2&quot;><b><a href=&quot;#organization&quot;>continue onto below</a></b></font></td>
<td width=&quot;11%&quot;> </td>
</tr>
</table></td>
</tr>
</table>
</form>

FORM TWO
<form method=&quot;GET&quot; action=&quot;/cgi-bin/misc/mailform.cgi&quot;>
<p align=Center>
<input type=hidden name=&quot;recipient&quot; value=&quot;mail2@isp.com&quot;>
<input type=hidden name=&quot;subject&quot; value=&quot;Section2 info&quot;>
<input type=hidden name=&quot;required&quot; value=&quot;email&quot;>
<a name=&quot;Section2&quot;></a>
<table width=&quot;100%&quot; cellpadding=&quot;2&quot;>
<tr >
<td width=&quot;69%&quot;><font face=&quot;ARIAL, TAHOMA, VERDANA&quot; size=&quot;2&quot; color=&quot;#ff0000&quot;><b>SECTION
2 :</b></font><font face=&quot;ARIAL, TAHOMA, VERDANA&quot; size=&quot;2&quot; color=&quot;004080&quot;>
 For this area, please enter the requested information.</font></td>
<td width=&quot;31%&quot;></td>
</tr>
</table>
<table width=&quot;100%&quot; cellpadding=&quot;2&quot;>
<tr>
<td width=&quot;575&quot;><font size=&quot;2&quot;><b>My question is: </b></font><BR> <table width=&quot;90%&quot; cellpadding=&quot;2&quot;>
<tr valign=&quot;middle&quot;>
<td width=&quot;56%&quot;><textarea name=&quot;section 2 txt&quot; cols=&quot;30&quot; id=&quot;section 2 txt&quot;></textarea>
</td>
<td width=&quot;1%&quot;> </td>
<td width=&quot;39%&quot;><font size=&quot;2&quot;><b><a href=&quot;#organization&quot;>continue onto below</a></b></font></td>
<td width=&quot;4%&quot;> </td>
</tr>
</table>
</td>
</tr>
</table>
</form>

FORM THREE
<form method=&quot;GET&quot; action=&quot;/cgi-bin/misc/mailform.cgi&quot;>
<p align=Center>
<input type=hidden name=&quot;recipient&quot; value=&quot;mail3@isp.com&quot;>
<input type=hidden name=&quot;subject&quot; value=&quot;Section 3 info&quot;>
<input type=hidden name=&quot;required&quot; value=&quot;email&quot;>
<font size=&quot;2&quot; color=&quot;#ff0000&quot;><b><a name=&quot;Section3&quot;></a></b></font>
<table width=&quot;100%&quot; cellpadding=&quot;2&quot;>
<tr >
<td width=&quot;69%&quot;><font size=&quot;2&quot; color=&quot;#ff0000&quot;><b>SECTION
3 :</b></font><font size=&quot;2&quot;>  For this area, please
enter the requested information.</font></td>
<td width=&quot;31%&quot;></td>
</tr>
</table>
<table width=&quot;100%&quot; cellpadding=&quot;2&quot;>
<tr>
<td><font size=&quot;2&quot;><b>My question is: <br>
</b></font> <table width=&quot;90%&quot; cellpadding=&quot;2&quot;>
<tr valign=&quot;middle&quot;>
<td width=&quot;56%&quot;><textarea name=&quot;section 3 txt&quot; cols=&quot;30&quot; id=&quot;section 3 txt&quot;></textarea>
</td>
<td width=&quot;1%&quot;> </td>
<td width=&quot;38%&quot;><font size=&quot;2&quot;><b><a href=&quot;#organization&quot;>continue onto below</a></b></font></td>
<td width=&quot;5%&quot;> </td>
</tr>
</table></td>
</tr>
</table>
</form>
<p>
<p>

CONTACT FORM
<form method=&quot;GET&quot; action=&quot;/cgi-bin/misc/mailform.cgi&quot;>
<p align=Center>
<input type=hidden name=&quot;recipient&quot; value=&quot;&quot;>
<input type=hidden name=&quot;subject&quot; value=&quot;&quot;>

<input type=hidden name=&quot;required&quot; value=&quot;email&quot;>
<br>
<a name=&quot;organization&quot;></a><font color=&quot;ff0000&quot; size=&quot;2&quot;><b>CONTINUE:</b></font><br>
<br>
<table>
<tr>
<td width=175 align=RIGHT></td>
<td></td>
</tr>
<tr valign=&quot;middle&quot;>
<td width=175 align=RIGHT><b>Your Name:</b></td>
<td width=300> <input type=&quot;text&quot; name=&quot;YOUR NAME&quot; maxlength=&quot;30&quot; size=&quot;30&quot;>
</td>
</tr>
<tr valign=&quot;middle&quot;>
<td width=175 align=&quot;RIGHT&quot;><b>Your Number:</b></td>
<td width=300> <input type=&quot;text&quot; name=&quot;YOUR TELEPHONE NUMBER&quot; maxlength=&quot;14&quot; size=&quot;14&quot;>
</td>
</tr>
</table>
<br>
<input type=&quot;submit&quot; value=&quot;Submit Your Question&quot; name=&quot;submit&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;reset&quot;>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</CENTER>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top