Link to home
Start Free TrialLog in
Avatar of deeayrian
deeayrianFlag for United States of America

asked on

Unable to pass dropdown list data from web form to email

I have added 2 drop down list fields to the contact form of the site template I am using.
I do not understand JavaScript enough to know how to edit the forms.js file in order to pass the values from those two drop down fields to the email.

In the forms.js file you can see that it is running a function called: getValFromLabel and all the other fields are identified with labels, but when I tried to add a label class to the select fields, the form wouldn't submit at all.  

Can someone please help me edit the code so that I can pass the values from those two drop down lists?
Thank you!

The Contact Form's HTML
<h2>Contact Form</h2>
								<form id="form1">
									<div class="success"> Contact form submitted!<br>
										<strong>We will be in touch soon.</strong> 
									</div>
									<fieldset>
										<label class="name">
											<input type="text" value="NAME:">
											<span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span> </label>
										<br>
                                        <label class="company_name">
											<input type="text" value="COMPANY/ORGANIZATION NAME:">
											<span class="empty">*This field is required.</span> </label>
										<br>
                                        
                                        <label class="website">
											<input type="text" value="WEBSITE:">
										</label>
										<br>
										<label class="email">
											<input type="email" value="E-MAIL:">
											<span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span> </label>
										<br>
										<label class="phone">
											<input type="tel" value="PHONE:">
											<span class="error">*This is not a valid phone number.</span> <span class="empty">*This field is required.</span> </label>
										<br>
                                        	
                                        	<select class="time">
                                            	<option value="">BEST TIME TO CONTACT YOU:</option>
                                                <option value="am">Contact me in the a.m.</option>
                                                <option value="pm">Contact me in the p.m.</option>
                                            </select>
                                            
                                       <br>
                                      
                                        	<select class="question">
                                                <option value="">SELECT ONE:</option>
                                            	<option value="new_business">Help with starting a new business</option>
                                                <option value="business_plan">Help with writing a business plan</option>
                                                <option value="audit">Company audit/analysis</option>
                                                <option value="project_mgmt">Project Management</option>
                                                <option value="other">Other</option>
                                            </select>
                                           
                                        <br>
                                            
                                        
										<label class="message">
											<textarea>ASK YOUR QUESTION:</textarea>
											<span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span> </label>
										<br>
										<div class="btns"><a href="#" class="btn" data-type="submit"><span></span>Send</a><a href="#" class="btn" data-type="reset"><span></span>Clear</a></div>
									</fieldset>
								</form>

Open in new window

Attaching the mailHandler.php and forms.js files for refernce.
C--Users-0BE000774-Documents-Website.php
C--Users-0BE000774-Documents-Website-.js
ASKER CERTIFIED SOLUTION
Avatar of lenamtl
lenamtl
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deeayrian

ASKER

I have been in contact with Template Monster and unfortunately because I am trying to add a field type that didn't exist on the template when I purchased it, they won't help me without charging me extra.  

Thank you for the link to the tutorial on their website, but that doesn't help me either.  I can create a basic php form without an issue, but in this template, there is a Js file managing a lot of the functionality and that's where I am hung up.  I don't know how to make the select fields work with that Js because my Js knowledge is very weak.

I am accepting this as a solution because I am going to go ahead and use the better form script you suggested and completely replace the one in this template.  At least with the one you recommended, I can undersand the code and make adjustments as needed, plus it seems more secure.

Thank you!