473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Form drop down menu of options linking to email addresses

24
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="javascript">

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] = "txtMailingRefNumber:::Mailing Reference Number";
// aCheckFields[1] = "txtID:::Operator ID";
// aCheckFields[6] = "txtDateTime:::Date/Time";




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

if ( oFormElement.value.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="frmSendMail" action="http://xxxxxxxxxxxxx/misc/sendmail/" method="POST" onsubmit="return XXX_JScheckForm( this )">

<input type="hidden" name="ctrlSendToEmailAddress" value="Email@Email=>Proforma"/>
<input type="hidden" name="ctrlEmailSubject" value="Proforma" />
<input type="hidden" name="ctrlMethod" value="E-MAIL" />
<input type="hidden" name="ctrlFromEmailAddress" value=""/>
<input type="hidden" name="ctrlRedirectURL" 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="tableBackLightestBlue" colspan="2" height="27">
<p class="pageHead"><b>Proforma</b></p>
<p style="color: #CC0000">Fields marked with * are mandatory</p>
</td>
</tr>


<!-- start of form details -->

<TR>
<TD class="tableBackLgtBlue2">EMAIL TYPE</td>
<td class="tableBackLgtBlue2">
REQUEST
</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">NAME OF CALLER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt01_Name_of_Caller"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TYPE OF CALLER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt02_Type_of_Caller"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">COMPANY POSTCODE</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt03_Company_Postcode"></td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TELEPHONE NUMBER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt04_Tel_No"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">POLICY NUMBER</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt05__Policy_No"></td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TYPE</td>
<td class="tableBackLgtBlue2"><select size="1" name="sel06_Type_of_Illustration">
<option value="Select">Select</option>
<option value="A">A</option>
<option value="B">B</option>
</select>
</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">MEMBERS NAME</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt07_Members_Name"></td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">SEX</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt08_Sex"></td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">DATE OF BIRTH</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt09_DOB"></td>
</tr>


<tr>
<td class="tableBackLgtBlue2">COMMENTS</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><textarea name="txt10_Comments" cols="30" rows="4"></textarea> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TURNAROUND TIMES</td>
<td class="tableBackLgtBlue2">Text will go here

</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">EMAIL RECIPIENT</td>
<td class="tableBackLgtBlue2"><p>Email@email</p></td>
</tr>




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

</table>
</td>

</tr>
</table>

<br><br>

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

Thanks
Aug 16 '07 #2
acoder
16,027 Expert Mod 8TB
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.getElementById.

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
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...
6
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...
3
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...
7
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>...
1
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...
2
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...
3
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,...
2
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.