Question

Generate form fields from a drop down menu

Asked by: InnerChild

Initially I had the following questions going  http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_23335795.html#discussion
What this solution provides is that when a person selects a number in the drop down then some form elements are dynamically created.

The problem I am having is that when submitting the form the only information that is being parsed is the number that is selected and not the information that is entered into the text boxes.

Also I now need to add a radio group as well to the group of elements that are created.

So as an example......

A Person clicks on 2 in the drop down then the fields that need to be dynamically created are...
Person 1 name
Person 1 email
Person 1 radio group
option 1
option 2
option 3

Person 2 name
Person 2 email
Person 2 radio group
option 1
option 2
option 3

And all the information entered submitted (name, email, and the option chosen) via email.
Thanks,


IC

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="/style.css" rel="stylesheet" type="text/css" />
<title>Custom contact page</title>
<script type="text/javascript">
function chkContacts(ele) {
	var div = document.getElementById('contactList');
	div.innerHTML = "";
	for (var i=1; i<=ele; i++) {
		addContact(i, div);
	}
	div.style.display = "";
}
function addContact(num, div) {
	var contact = document.createElement('p');
	var textName = document.createTextNode('Contact #' + num + ' Name: \n');
	var contactName = document.createElement('input');
	contactName.type = 'text';
	contactName.name = 'contactName' + num;
	contactName.id = 'contactName' + num;
	var br = document.createElement('br');
	var textEmail = document.createTextNode('Contact #' + num + ' Email: \n');
	var contactEmail = document.createElement('input');
	contactEmail.type = 'text';
	contactEmail.name = 'contactEmail' + num;
	contactEmail.id = 'contactEmail' + num;
	contact.appendChild(textName);
	contact.appendChild(contactName);
	contact.appendChild(br);
	contact.appendChild(textEmail);
	contact.appendChild(contactEmail);
	div.appendChild(contact);
}
</script>
</head>
 
<body>
<h3>Page for contact info</h3>
 
<br /><br />
<form action="contact.php" method="post" />
Select number of contacts:
<select name="nContacts" onchange="chkContacts(this.value);">
<option value="0">--Choose--</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
<br /><br />
<div id="contactList" style="display: none;"></div>
<br /><br />
<input type="submit" value="Send" />
</form>
 
 
</body>
</html>

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-04-28 at 10:59:32ID23359587
Tags

Java Script, Ajax, PHP

Topic

JavaScript

Participating Experts
1
Points
100
Comments
10

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. radio fields.
    I have several radio input form fields named "radiofield" and a text input field named "textfield" residing in one frame. I am trying to read their selected or default values from another frame using the following: vara = parent.frames['framea'].document...
  2. Radio buttons and javascript
    I have the following HTML code: <tr bgcolor="#EEEEEE"> <td valign="top" nowrap>Margin UOM:</td> <td valign="top"> <input type="radio" name="uom" value="GT" checked>GT&nbsp; &l...
  3. Page redirection based on radio button chosen
    Hi Guys, I need to have users directed to different pages depending on a particular answer they have chosen in a questionnaire. The Question in particular uses 2 radio buttons, one has a value of "Yes" and the other "No". If "Yes" is selected I...
  4. Select Chosen Option in Menu
    I have the following script set up so that one someone choses an option from a menu it passes through variables, but it does not "select" that option that was chosen. Here is my code so far: <html> <head> <title>Test</title> <script langu...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: InnerChildPosted on 2008-04-28 at 11:53:51ID: 21456582

OK I have been working away and I can pass the infomration along but it is tedious beause the form element name is attached dynamically as well so as an example if I have a form element that is txtFirstName in my PHP I have to pass the following varialbes to catch everything...

txtFirstName1
txtFirstName2
txtFirstName3
txtFirstName4
txtFirstName5
txtFirstName6
txtFirstName7
txtFirstName8

which also generates a mostly empty email.

Now I was also able to scratch together a radio function but the problem I am having with that is that is that it is acting as one giant raio group.  I could switch it to another drop down if that makes things easier.

Hope this helps,

IC

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="/style.css" rel="stylesheet" type="text/css" />
<title>Custom contact page</title>
<script type="text/javascript">
function chkContacts(ele) {
	var div = document.getElementById('contactList');
	div.innerHTML = "";
	for (var i=1; i<=ele; i++) {
		addContact(i, div);
	}
	div.style.display = "";
}
function addContact(num, div) {
	var contact = document.createElement('p');
	var textName1 = document.createTextNode('#' + num + ' Last Name: \n\n');
	var contactLastName = document.createElement('input');
	contactLastName.type = 'text';
	contactLastName.name = 'contactLastName' + num;
	contactLastName.id = 'contactLastName' + num;
	var br = document.createElement('br');
	
	var textName = document.createTextNode('#' + num + ' First Name: \n');
	var contactFirstName = document.createElement('input');
	contactFirstName.type = 'text';
	contactFirstName.name = 'contactFirstName' + num;
	contactFirstName.id = 'contactFirstName' + num;
	var br = document.createElement('br');
	
	var textEmail = document.createTextNode('#' + num + ' Email: \n');
	var contactEmail = document.createElement('input');
	contactEmail.type = 'text';
	contactEmail.name = 'contactEmail' + num;
	contactEmail.id = 'contactEmail' + num;
	
	var textRadio = document.createTextNode('#' + num + ' Score: \n');
	var contactRadio = document.createElement('input');
	contactRadio.type = 'radio';
	contactRadio.id ="myradiobutton";
	contactRadio.name ="myradiobutton";
    contactRadio.onclick = function() { enableRadio('1') };
	
	var textRadio2 = document.createTextNode('#' + num + ' Score2: \n');
	var contactRadio2 = document.createElement('input');
	contactRadio2.type = 'radio';
	contactRadio2.id ="myradiobutton";
	contactRadio2.name ="myradiobutton";
    contactRadio2.onclick = function() { enableRadio('2') };
	
   	contact.appendChild(textRadio);
	contact.appendChild(contactRadio);
 
	   	contact.appendChild(textRadio2);
	contact.appendChild(contactRadio2);
	
				//br
	var br=document.createElement("br");
	contact.appendChild(br);
	
	contact.appendChild(textName);
	contact.appendChild(contactLastName);
			//br
	var br=document.createElement("br");
	contact.appendChild(br);
	
	contact.appendChild(textName1);
	contact.appendChild(contactFirstName);
			//br
	var br=document.createElement("br");
	contact.appendChild(br);
	
	contact.appendChild(textEmail);
	contact.appendChild(contactEmail);
	div.appendChild(contact);
}
</script>
<style type="text/css">
<!--
body {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
#contactList{
	text-align: right;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form  action="contact.php" method="POST">
  <table border="1" cellpadding="5">
    <tr>
      <td colspan="2"><table class="Normal" cellSpacing="0" cellPadding="2" width="100%" border="0">
          <tr>
            <td width="300" align="right">Last Name: </td>
            <td align="left" vAlign="top"><input type="text" name="txtLastName" id="txtLastName"></td>
          </tr>
          <tr>
            <td align="right">First Name: </td>
            <td vAlign="top"><input type="text" name="txtFirstName" id="txtFirstName"></td>
          </tr>
          <tr>
            <td align="right">Mailing Address: </td>
            <td vAlign="top"><textarea name="textareaMailing" id="textareaMailing" cols="45" rows="5"></textarea></td>
          </tr>
          <tr>
            <td align="right">City: </td>
            <td vAlign="top"><input type="text" name="txtCity" id="txtCity"></td>
          </tr>
          <tr>
            <td align="right">Province: </td>
            <td vAlign="top"><select name="ddProvince" id="ddProvince">
                <option value="54">Alberta</option>
                <option value="55">British Columbia</option>
                <option value="56">Manitoba</option>
                <option value="57">New Brunswick</option>
                <option value="58">Newfoundland</option>
                <option value="59">Nova Scotia</option>
                <option value="60">Ontario</option>
                <option value="61">Prince Edward Island</option>
                <option value="62">Quebec</option>
                <option value="63">Saskatchewan</option>
                <option value="188">Northwest Territories</option>
                <option value="189">Nunavut</option>
                <option value="190">Yukon</option>
              </select></td>
          </tr>
          <tr>
            <td align="right">Postal Code: </td>
            <td vAlign="top"><input type="text" name="txtPostal" id="txtPostal"></td>
          </tr>
          <tr>
            <td align="right">Employer: </td>
            <td vAlign="top"><input type="text" name="txtEmployeer" id="txtEmployeer"></td>
          </tr>
          <tr>
            <td align="right">Position Title: </td>
            <td vAlign="top"><input type="text" name="txtPositionTitle" id="txtPositionTitle"></td>
          </tr>
          <tr>
            <td align="right">Business Phone: </td>
            <td vAlign="top"><input type="text" name="txtBusinessPhone" id="txtBusinessPhone">
              &nbsp;&nbsp;</td>
          </tr>
          <tr>
            <td align="right">Email Address: </td>
            <td vAlign="top"><input type="text" name="txtEmail" id="txtEmail"></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td colspan="2"><TABLE class="Normal" width="100%" border="0">
          <TR>
            <TD width="300" align="right" vAlign="top" class="Normal">Please indicate your 
              usual 18-hole golf score below:</TD>
            <TD vAlign="top" align="left" width="170"><table id="ucContent2__ctl0_ucModuleContent__ctl0__ctl0_rblScore" class="Normal" border="0">
                <tr>
                  <td><p>
                    <label>
                      <input name="GolfScore" type="radio" id="GolfScore_0" value="Never Played" checked>
                      Never Played</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="Played a few times" id="GolfScore_1">
                      Played a few times</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="120+" id="GolfScore_2">
                      120+</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="111-120" id="GolfScore_3">
                      111-120</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="101-110" id="GolfScore_4">
                      101-110</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="90-100" id="GolfScore_5">
                      90-100</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="Under 90 (Please specify)" id="GolfScore_6">
                      Under 90 (Please specify)</label>
                    <br>
                  </p></td>
                </tr>
              </table></TD>
            <TD vAlign="bottom" align="left"><input name="txtGolfScore" type="text" id="Over90" /></TD>
          </TR>
        </TABLE></td>
    </tr>
    <tr>
      <td colspan="2">How many other people are you registering?</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><select name="nContacts" onchange="chkContacts(this.value);">
        <option value="0">--Choose--</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
      </select>
        <br />
        <br />
        <div id="contactList" style="display: none;"></div>
        <br />
        <br /></td>
    </tr>
    <tr>
      <td colspan="2"><div align="right">
          <input name="RSVP" type="submit" class="formbutton11" value="Submit" />
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:

Select allOpen in new window

 

by: InnerChildPosted on 2008-04-29 at 08:28:49ID: 21463183

So I have made some changes and the following code uses a dropdown instead of radio buttons.  But the script I am using http://www.agitprop.org.au/scripts/catchall_mail_php.php that is suppose to catch any form fields isn't displaying the drop down options....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="/style.css" rel="stylesheet" type="text/css" />
<title>Custom contact page</title>
<script type="text/javascript">
function chkContacts(ele) {
	var div = document.getElementById('contactList');
	div.innerHTML = "";
	for (var i=1; i<=ele; i++) {
		addContact(i, div);
	}
	div.style.display = "";
}
function addContact(num, div) {
	var contact = document.createElement('p');
	var textName1 = document.createTextNode('#' + num + ' Last Name: \n\n');
	var contactLastName = document.createElement('input');
	contactLastName.type = 'text';
	contactLastName.name = 'contactLastName' + num;
	contactLastName.id = 'contactLastName' + num;
	var br = document.createElement('br');
	
	var textName = document.createTextNode('#' + num + ' First Name: \n');
	var contactFirstName = document.createElement('input');
	contactFirstName.type = 'text'; 
	contactFirstName.name = 'contactFirstName' + num;
	contactFirstName.id = 'contactFirstName' + num;
	var br = document.createElement('br');
	
	//dynamic creation of the email element
	var textEmail = document.createTextNode('#' + num + ' Email: \n');
	var contactEmail = document.createElement('input');
	contactEmail.type = 'text';
	contactEmail.name = 'contactEmail' + num;
	contactEmail.id = 'contactEmail' + num;
	
	//dynamic creation of the drop down element
	var textSelect = document.createTextNode('#' + num + ' Golf Score: \n');
	var oSelect=document.createElement("select");
	var oOption = document.createElement("option");
	var t0 = document.createTextNode("Option 1");
	oOption.id = 'oOption' + num;
	
	var oOption1 = document.createElement("option");
	var t1 = document.createTextNode("Option 2);
 
	
	// adds options to the drop down menu
	
	oOption.appendChild(t0);
	oOption1.appendChild(t1);
	oSelect.appendChild(oOption);
	oSelect.appendChild(oOption1);
 
	
	
	// add options to form
	contact.appendChild(textSelect);
	contact.appendChild(oSelect);
	
				//br
	var br=document.createElement("br");
	contact.appendChild(br);
	
	contact.appendChild(textName);
	contact.appendChild(contactLastName);
			//br
	var br=document.createElement("br");
	contact.appendChild(br);
	
	contact.appendChild(textName1);
	contact.appendChild(contactFirstName);
			//br
	var br=document.createElement("br");
	contact.appendChild(br);
	
	contact.appendChild(textEmail);
	contact.appendChild(contactEmail);
	div.appendChild(contact);
}
</script>
<style type="text/css">
<!--
body {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
#contactList{
	text-align: right;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form  action="catchall_mail.php" method="POST">
  <table border="1" cellpadding="5">
    <tr>
      <td colspan="2"><table class="Normal" cellSpacing="0" cellPadding="2" width="100%" border="0">
          <tr>
            <td width="300" align="right">Last Name: </td>
            <td align="left" vAlign="top"><input type="text" name="txtLastName" id="txtLastName"></td>
          </tr>
          <tr>
            <td align="right">First Name: </td>
            <td vAlign="top"><input type="text" name="txtFirstName" id="txtFirstName"></td>
          </tr>
          <tr>
            <td align="right">Mailing Address: </td>
            <td vAlign="top"><textarea name="textareaMailing" id="textareaMailing" cols="45" rows="5"></textarea></td>
          </tr>
          <tr>
            <td align="right">City: </td>
            <td vAlign="top"><input type="text" name="txtCity" id="txtCity"></td>
          </tr>
          <tr>
            <td align="right">Province: </td>
            <td vAlign="top"><select name="ddProvince" id="ddProvince">
                <option value="Alberta">Alberta</option>
                <option value="British Columbia">British Columbia</option>
                <option value="Manitoba">Manitoba</option>
                <option value="New Brunswick">New Brunswick</option>
                <option value="Newfoundland">Newfoundland</option>
                <option value="Nova Scotia">Nova Scotia</option>
                <option value="Ontario">Ontario</option>
                <option value="Prince Edward Island">Prince Edward Island</option>
                <option value="Quebec">Quebec</option>
                <option value="Saskatchewan">Saskatchewan</option>
                <option value="Northwest Territories">Northwest Territories</option>
                <option value="Nunavut">Nunavut</option>
                <option value="Yukon">Yukon</option>
              </select></td>
          </tr>
          <tr>
            <td align="right">Postal Code: </td>
            <td vAlign="top"><input type="text" name="txtPostal" id="txtPostal"></td>
          </tr>
          <tr>
            <td align="right">Employer: </td>
            <td vAlign="top"><input type="text" name="txtEmployeer" id="txtEmployeer"></td>
          </tr>
          <tr>
            <td align="right">Position Title: </td>
            <td vAlign="top"><input type="text" name="txtPositionTitle" id="txtPositionTitle"></td>
          </tr>
          <tr>
            <td align="right">Business Phone: </td>
            <td vAlign="top"><input type="text" name="txtBusinessPhone" id="txtBusinessPhone">
              &nbsp;&nbsp;</td>
          </tr>
          <tr>
            <td align="right">Email Address: </td>
            <td vAlign="top"><input type="text" name="txtEmail" id="txtEmail"></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td colspan="2"><TABLE class="Normal" width="100%" border="0">
          <TR>
            <TD width="300" align="right" vAlign="top" class="Normal">Please indicate your 
              usual 18-hole golf score below:</TD>
            <TD vAlign="top" align="left" width="170"><table id="table" class="Normal" border="0">
                <tr>
                  <td><p>
                    <label>
                      <input name="GolfScore" type="radio" id="GolfScore_0" value="Never Played" checked>
                      Never Played</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="Played a few times" id="GolfScore_1">
                      Played a few times</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="120+" id="GolfScore_2">
                      120+</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="111-120" id="GolfScore_3">
                      111-120</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="101-110" id="GolfScore_4">
                      101-110</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="90-100" id="GolfScore_5">
                      90-100</label>
                    <br>
                    <label>
                      <input type="radio" name="GolfScore" value="Under 90 (Please specify)" id="GolfScore_6">
                      Under 90 (Please specify)</label>
                    <br>
                  </p></td>
                </tr>
              </table></TD>
            <TD vAlign="bottom" align="left"><input name="txtGolfScore" type="text" id="Over90" /></TD>
          </TR>
        </TABLE></td>
    </tr>
    <tr>
      <td colspan="2">How many other people are you registering?</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><select name="nContacts" onchange="chkContacts(this.value);">
        <option value="0">--Choose--</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
      </select>
        <br />
        <br />
        <div id="contactList" style="display: none;"></div>
        <br />
        <br /></td>
    </tr>
    <tr>
      <td colspan="2"><div align="right">
          <input name="RSVP" type="submit" class="formbutton11" value="Submit" />
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:

Select allOpen in new window

 

by: b0lsc0ttPosted on 2008-04-29 at 18:33:31ID: 21467539

Does the email come to you at all?  Does it have any info from the form?  I don't really understand if your message is just missing the option or if there is some other issue.

Thanks for clearing it up.

bol

 

by: InnerChildPosted on 2008-04-29 at 20:00:46ID: 21467822

Everything in the form gets sent in the email except for the drop down after you select the number of people registering.

So if you say one person is registering there is a drop down plus a text feild for name and email.  THe text fields get emails but the option selected in the drop down doesn't.

Hope that helps.

IC

 

by: b0lsc0ttPosted on 2008-04-30 at 00:04:31ID: 21468619

Is it the nContacts value that doesn't appear?  It showed in my test.  I did see an error in your code on line 48 above.

      var t1 = document.createTextNode("Option 2");

That may be your problem.  Otherwise look for an nContacts part in the email and that is from the list.  The value should be there too.

Do you get the Province value?

bol

 

by: InnerChildPosted on 2008-04-30 at 06:36:40ID: 21470543

Yes I get everything except the vart0 "Option 1" and the var t1 "Option 2"

IC

 

by: InnerChildPosted on 2008-04-30 at 10:30:28ID: 21472832

So just to confirm I am getting the number of people selected in the nContacts variable but when you select lets say one person you get four more form fields for first name, last name email, and a dropdown for golf score.  All the infoamriton is being emailed except the drop down for the golf score.

IC

 

by: b0lsc0ttPosted on 2008-04-30 at 16:20:44ID: 21475394

I wish the problem would've been more clear from the start.  I had assumed you were talking about nContacts since that was the main pull down related to this.  Thanks for correcting that error and providing info so I knew the problem.

You are not getting the golf score because the select that is made doesn't have a name and the options didn't have values.  There was nothing being sent in the form for that field.

I have corrected it in the code below.  Of course you can use whatever you want for the name in the selects and values in the option tags.  The key is to make sure you specify one so the form will have it.

Let me know if you have a question or need more info.

bol

	//dynamic creation of the drop down element
	var textSelect = document.createTextNode('#' + num + ' Golf Score: \n');
	var oSelect=document.createElement("select");
	oSelect.name = "golfScore" + num;
	oSelect.id = "golfScore" + num;
	var oOption1 = document.createElement("option");
	var t0 = document.createTextNode("Option 1");
	oOption1.value = 'oOption1';
	
	var oOption2 = document.createElement("option");
	var t1 = document.createTextNode("Option 2");
	oOption2.value = "oOption2";
 
	
	// adds options to the drop down menu
	
	oOption1.appendChild(t0);
	oOption2.appendChild(t1);
	oSelect.appendChild(oOption1);
	oSelect.appendChild(oOption2);
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

Select allOpen in new window

 

by: InnerChildPosted on 2008-04-30 at 16:44:07ID: 31453100

Thanks, the form is working properly now.

IC

 

by: b0lsc0ttPosted on 2008-04-30 at 18:37:34ID: 21475939

Great!  I'm glad I could help and we got it working.  Thanks for the grade, the points and the fun question.

bol

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...