473,586 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form drop down menu of options linking to email addresses

24 New Member
Hi
I have a created a form. I have a field called Type with options A or B. I want to have my form so that it you select option A the rest of the form will appear and the Email Recepient field will show the email address that its to submit to and if you select option B then the rest of the form appear and the Email Recepient field will show a different email adress for option B and the form will then submit to the option B address. Im not sure how to go about getting this to work or if its feasable.

My code is below:

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>

<title>Proforma </title>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">

<script language="javas cript">

function XXX_JScheckForm ( f )
{

var sErrors = "";
var sfocusElements;
var aCheckFields = new Array();

aCheckFields[0] = "txt02_Name_of_ Caller:::Name of Caller";
aCheckFields[1] = "txt03_Type_of_ Caller:::Type of Caller";
aCheckFields[2] = "txt04_Tel_No:: :Tel No";
aCheckFields[3] = "txt10_Comments :::Comments";
// aCheckFields[4] = "txtMailingRefN umber:::Mailing Reference Number";
// aCheckFields[1] = "txtID:::Operat or ID";
// aCheckFields[6] = "txtDateTime::: Date/Time";




// Loop through each field identified as mandatory
for ( var i = 0; i < aCheckFields.le ngth; i++ )
{
var aData = aCheckFields[i].split( /\:\:\:/ );
var oFormElement = eval( "f." + aData[0] );

if ( oFormElement.va lue.match( /^\s*$/ ) )
{
sErrors += aData[1] + "\n";

if ( ! sfocusElements ) { sfocusElements = aData[0]; }

}
}

if ( sErrors )
{
alert( "The following fields are required - \n\n" + sErrors );
eval( "f." + sfocusElements + ".focus()" );
return false;
}

return true;

}

</script>



<FORM name="frmSendMa il" action="http://xxxxxxxxxxxxx/misc/sendmail/" method="POST" onsubmit="retur n XXX_JScheckForm ( this )">

<input type="hidden" name="ctrlSendT oEmailAddress" value="Email@Em ail=>Proforma"/>
<input type="hidden" name="ctrlEmail Subject" value="Proforma " />
<input type="hidden" name="ctrlMetho d" value="E-MAIL" />
<input type="hidden" name="ctrlFromE mailAddress" value=""/>
<input type="hidden" name="ctrlRedir ectURL" value="xxxxxxxx " />

<table width="90%" border="0" cellspacing="0" cellpadding="0" bgcolor="8ED1E6 ">
<tr>
<td valign="top" align="left">
<table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="8ED1E6 " align="center">
<tr valign="top" align="left">
<td class="tableBac kLightestBlue" colspan="2" height="27">
<p class="pageHead "><b>Profor ma</b></p>
<p style="color: #CC0000">Fields marked with * are mandatory</p>
</td>
</tr>


<!-- start of form details -->

<TR>
<TD class="tableBac kLgtBlue2">EMAI L TYPE</td>
<td class="tableBac kLgtBlue2">
REQUEST
</td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">NAME OF CALLER</td>
<td class="tableBac kLgtBlue2" style="color: #CC0000"><input type="text" name="txt01_Nam e_of_Caller"> *</td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">TYPE OF CALLER</td>
<td class="tableBac kLgtBlue2" style="color: #CC0000"><input type="text" name="txt02_Typ e_of_Caller"> *</td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">COMP ANY POSTCODE</td>
<td class="tableBac kLgtBlue2"><inp ut type="text" name="txt03_Com pany_Postcode"> </td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">TELE PHONE NUMBER</td>
<td class="tableBac kLgtBlue2" style="color: #CC0000"><input type="text" name="txt04_Tel _No"> *</td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">POLI CY NUMBER</td>
<td class="tableBac kLgtBlue2"><inp ut type="text" name="txt05__Po licy_No"></td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">TYPE </td>
<td class="tableBac kLgtBlue2"><sel ect size="1" name="sel06_Typ e_of_Illustrati on">
<option value="Select"> Select</option>
<option value="A">A</option>
<option value="B">B</option>
</select>
</td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">MEMB ERS NAME</td>
<td class="tableBac kLgtBlue2"><inp ut type="text" name="txt07_Mem bers_Name"></td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">SEX</td>
<td class="tableBac kLgtBlue2"><inp ut type="text" name="txt08_Sex "></td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">DATE OF BIRTH</td>
<td class="tableBac kLgtBlue2"><inp ut type="text" name="txt09_DOB "></td>
</tr>


<tr>
<td class="tableBac kLgtBlue2">COMM ENTS</td>
<td class="tableBac kLgtBlue2" style="color: #CC0000"><texta rea name="txt10_Com ments" cols="30" rows="4"></textarea> *</td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">TURN AROUND TIMES</td>
<td class="tableBac kLgtBlue2">Text will go here

</td>
</tr>

<TR>
<TD class="tableBac kLgtBlue2">EMAI L RECIPIENT</td>
<td class="tableBac kLgtBlue2"><p>E mail@email</p></td>
</tr>




<tr valign="top" align="left">
<td class="tableBac kLgtBlue2" colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="19">
<tr valign="top" align="left">
<td width="20%">&nb sp;</td>
<td align="center"> &nbsp; </td>
<td align="right" width="20%">
<INPUT TYPE="submit" class="xxxButto n" value="SEND MAIL" />
</td>
</tr>
</table>
</td>
</tr>

</table>
</td>

</tr>
</table>

<br><br>

</FORM>
</body>
</html>[/HTML]
Aug 15 '07 #1
2 1660
AR123
24 New Member
Would really appreciate if someone could help me out with this.

Thanks
Aug 16 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Set the visibility property to "hidden" for all fields. Call a function onchange (for the type field) which shows all the fields (set the visibility property to "visible") and sets the email field value to either email A or email B depending on the selection. You might want to give the <p> element which contains the email an id so you can easily access it using document.getEle mentById.

Set the action property when the validation passes to the selected email address (or you could set in the above function).
Aug 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2953
by: KK | last post by:
Drop-down menus are the hottest thing since Wonder Bread but . . . 1. Alot of people put them in the they-look-nice-but-you-cant-code-them-right-so-they-always-look-messed-up category (a la "frames"). Do you think this is true> 2. Some people think they take up too much KB. 3. Some people are worried that people who have javascript turned off...
6
15405
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens because I am not getting any errors on the page. <html> <script language="javascript"> var phaseArray = new phaseArray(4); var phaseTypeId =...
3
23297
by: Darren | last post by:
Please Help Me!! I've created a typical <form> and a <select> element. The options are created dynamically from my access database (using asp). There are about 70 options, and when you click the dropdown button, it shows about 25 (depending on screen resolution) and then the gives you a scroll bar to get to the rest. My question is,...
7
3590
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
1
2853
by: phpnewb | last post by:
Hi, I know i'm doing it wrong, but I'm using a while loop right now to create several instances of a drop down menu. It gives me undesirable results. Can you tell me the right way to do it. Below are a bit of information on what i did if you want t read it. When I choose select an option in the drop down menu and hit submit, I increase a...
2
3061
by: ponyeyes | last post by:
Hi There, I am a bit of a newbie to PHP programming and I would like to know how I can place a selected drop down option into a PHP variable and then produce an sql query which incorporates this variable. I have created a dynamic drop down menu that populates itself with data from a MySQL table. I now want it to populate a second drop-down...
3
2036
by: drblitzkrieg | last post by:
Hi, I have a page with 2 drop-down menus. The task is, when you select 1 menu, your selection then changes the options available in the other. This data happens to be drawn from a mysql database, so I wouldn't think that it could be done purely in Javascript, but rather a combination of PHP generating some JS code. Thing is, I don't even see...
2
6980
by: RLN | last post by:
I was at this link to add a menu bar to my Access app. http://office.microsoft.com/en-s/access/HP051890341033.aspx I got the menu bar added, but had some more questions about it. In the link above, there was mention of assigning it as the "Global menu" bar, but it does not indicate how to specify a custom menu bar as the global bar. Any...
3
2202
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus that are SELECT elements (javascript-- one named arrivalcity and one named returncity). Basically they ask for a departure and return city and another...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.