www.webdeveloper.com
Results 1 to 9 of 9

Thread: HTML Drop down menu help

  1. #1
    Join Date
    Mar 2010
    Location
    Minneapolis
    Posts
    32

    HTML Drop down menu help

    Hi, i am fairly new to development and dont have much experience with HTML. i've mainly just used ColdFusion. I am trying to make a registration form with HTML. i can get text fields to send directly into an email, but now that i added the drop down menu i am running into issues.

    i know i can add a "mailto:example@email.com" tag, but that opens a email screen. is their anyway to bypass this?

    their is alot more code, but just for the sake of keeping this short, here is the dropdown menu.

    <td valign="bottom"><div class="formPrompt">Gender: </div></td>
    <td valign="top">
    <FORM METHOD="POST" ACTION="" name="gender">
    <SELECT SIZE="1" NAME="gender">
    <OPTION VALUE="">Male</OPTION>
    <OPTION VALUE="">Female</OPTION>
    </SELECT></FORM>

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    What method did you use that was working before?

    option requires a value. Your's are empty.

  3. #3
    Join Date
    Mar 2010
    Location
    Minneapolis
    Posts
    32
    Hi Fang,

    Before i was using just ColdFusion, with that i was able to get all the text fields to work. but as soon as i tried to add drop down menu's it all went down hill lol

    here's what the text fields looked like:

    <tr>
    <td><div class="formPrompt">Primary Phone Number: <font color="red">*</font> <BR />
    </div></td>
    <td align=""><cfinput type="text" name="phonenumber" required="Yes" validate="telephone" message="Please specify a valid phone number in 000-000-0000 format." size="32" value="000-000-0000"></td>
    </tr>

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    As long as the options have the value attribute with a value, then there should be no problem.

  5. #5
    Join Date
    Mar 2010
    Location
    Minneapolis
    Posts
    32
    Awesome. I will give it a shot.
    Thanks

  6. #6
    Join Date
    Mar 2010
    Location
    Minneapolis
    Posts
    32
    hey again, sorry. still running into some troubles. i don't get any error messages. but it just kicks me to the top of the page when i try to submit my form. here's what i've got at the moment (took out some of the options to shorten code). I am thinking it has to be something in the dropdown menu <form method>. any suggestions?

    <CFIF Action IS "">

    <cfform action="database.cfm?action=submit" method="post">
    <table width="80%" border="0" cellpadding="5" cellspacing="0">
    <tr bgcolor="#EFEFEF">
    <td><div class="formPrompt">E-mail Address: <font color="red">*</font> </div></td>
    <td align="right"><cfinput type="text" name="emailAddress" required="Yes" validate="email" message="Please specify a valid e-mail address." size="33"></td>
    </tr>
    <tr>
    <td><div class="formPrompt">Last Name: <font color="red">*</font> </div></td>
    <td align="right"><cfinput type="text" name="lastname" required="yes" message="Please enter your last name" size="33"></td>
    </tr> <tr bgcolor="#EFEFEF">
    <td><div class="formPrompt">First Name: <font color="red">*</font> </div></td>
    <td align="right"><cfinput type="text" name="firstname" required="yes" message="Please enter your first name" size="33"></td>
    </tr> <tr>
    <td><div class="formPrompt">Middle Initial: <font color="red">*</font> </div></td>
    <td align="right"><cfinput type="text" name="middlename" required="yes" message="Please enter your middle initial" size="33"></td>
    </tr> <tr bgcolor="#EFEFEF">
    <td valign="bottom"><div class="formPrompt">Gender: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
    <td valign="top">
    <FORM METHOD="POST" ACTION="" name="gender">
    <SELECT SIZE="1" NAME="gender">
    <OPTION VALUE="Male">Male</OPTION>
    <OPTION VALUE="Female">Female</OPTION>
    </SELECT></FORM></td><td></td>
    </tr> <tr>
    <td><div class="formPrompt">Primary Phone Number: <font color="red">*</font> <BR />
    </div></td>
    <td align=""><cfinput type="text" name="phonenumber" required="Yes" validate="telephone" message="Please specify a valid phone number in 000-000-0000 format." size="32" value="000-000-0000"></td>
    </tr> <tr bgcolor="#EFEFEF">
    <td><div class="formPrompt">Alternative Number 1: </div></td>
    <td align=""><cfinput type="text" name="altphoneNumber1" required="no" size="32" value="000-000-0000"></td>
    </tr> <tr>
    <td><div class="formPrompt">Alternative Number 2: </div></td>
    <td align=""><cfinput type="text" name="altphoneNumber2" required="no" size="32" value="000-000-0000"></td>
    </tr> <tr bgcolor="#EFEFEF">
    <td><div class="formPrompt">Street: <font color="red">*</font> </div></td>
    <td align=""><cfinput type="text" name="street" required="yes" message="Please specify a valid street address."size="32"></td>
    </tr>
    <td><div class="formPrompt">City: <font color="red">*</font> </div></td>
    <td align=""><cfinput type="text" name="city" required="yes" message="Please enter a City."size="32"></td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">State: <font color="red">*</font> </div></td>
    <td align="">
    <FORM METHOD="POST" ACTION="" name="state">
    <SELECT SIZE="1" NAME="state">
    <OPTION VALUE="Alabama">Alabama</OPTION>
    </SELECT>
    </FORM>
    </td>
    </tr>
    <td><div class="formPrompt">Zip Code: <font color="red">*</font> </div></td>
    <td align=""><cfinput type="text" name="zipcode" required="yes" message="Please specify a valid Zip Code."size="32"></td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Country: </div></td>
    <td align=""><cfinput type="text" name="country" required="no" size="32"></td>
    </tr>
    <td><div class="formPrompt">Date of Birth (Month-Day-Year): <font color="red">*</font> </div></td>
    <td align=""><cfinput type="text" name="birthdate" required="yes" message="Please specify a valid Birthdate (month-day-year) format."size="32" value="00-00-0000"></td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Race: </div></td>
    <td align=""><cfinput type="text" name="race" required="no" size="32"></td>
    </tr>
    <td><div class="formPrompt">Height in feet: <font color="red">*</font></div></td>
    <td align="">
    <FORM METHOD="POST" ACTION="" name="heightft">
    <SELECT SIZE="1" NAME="heightft">
    <OPTION VALUE="Select One">Select One</OPTION>
    </SELECT>
    </FORM>
    </td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Height in Inches: <font color="red">*</font> </div></td>
    <td align="">
    <FORM METHOD="POST" ACTION="" name="heightin">
    <SELECT SIZE="1" NAME="heightin">
    <OPTION VALUE="Select One">Select One</OPTION>
    <OPTION VALUE="1 Inch">1 Inch</OPTION>
    </SELECT>
    </FORM>
    </td>
    </tr>
    <td><div class="formPrompt">Weight in Pounds: <font color="red">*</font> </div></td>
    <td align=""><cfinput type="text" name="weightlb" required="yes" message="Please specify your weight in pounds."size="32"></td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Tobacco Use: <font color="red">*</font> </div></td>
    <td align="">
    <FORM METHOD="POST" ACTION="" name="tobaccouse">
    <SELECT SIZE="1" NAME="tobaccouse">
    <OPTION VALUE="no">no</OPTION>
    </SELECT>
    </FORM>
    </td>
    </tr>
    <td><div class="formPrompt">If yes, type of tobacco: </div></td>
    <td align="left">
    <FORM METHOD="POST" ACTION="" name="tobaccoyes">
    <SELECT SIZE="1" NAME="tobaccoyes">
    <OPTION VALUE="Select One">Select One</OPTION>
    </SELECT>
    </FORM>
    </td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Year Quit: </div></td>
    <td align=""><cfinput type="text" name="tobaccoquit" required="no" size="32"></td>
    </tr>
    <td><div class="formPrompt">Please list any chronic medical conditions (i.e. Diabetes, Hepatitis, Depression, high blood pressure etc.) </div></td>
    <td valign="middle" align=""><cfinput type="text" name="chronicconditions" required="no" size="32"></td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Please list any medications (prescription or over the counter) that you take on a regular basis </div></td>
    <td align="" valign="middle"><cfinput type="text" name="medications" required="no" size="32"></td>
    </tr>
    <td><div class="formPrompt">Female Volunteers Only </div></td>
    <td align="">
    <FORM METHOD="POST" ACTION="" name="femaleonly">
    <SELECT SIZE="1" NAME="femaleonly">
    <OPTION VALUE="Select One">Select One</OPTION>
    </SELECT></td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">If you are a child bearing potential, please select your method of contraceptive: </div></td>
    <td align="">
    <FORM METHOD="POST" ACTION="" name="childbearing">
    <SELECT SIZE="1" NAME="childbearing">
    <OPTION VALUE="None">None</OPTION>
    </SELECT>
    </FORM>
    </td>
    </tr>
    <td><div class="formPrompt">Please list any food or medication allergies </div></td>
    <td align="">
    <FORM METHOD="POST" ACTION="" name="dietaryrequirements">
    <SELECT SIZE="1" NAME="dietaryrequirements">
    <OPTION VALUE="None">None</OPTION>
    </SELECT>
    </td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Do you have any dietary requirements? </div></td>
    <td align=""><cfinput type="text" name="dietaryrequirements" required="no" size="32"></td>
    </tr>
    <td><div class="formPrompt">Are you interested in a specific study? </div></td>
    <td align=""><cfinput type="text" name="specificstudy" required="no" size="32"></td>
    </tr>
    <tr bgcolor="#EFEFEF"><td><div class="formPrompt">Where did you hear about us? </div></td>
    <td align=""><cfinput type="text" name="hearaboutus" required="no" size="32"></td>
    </tr>


    <tr>
    <td><div class="formPrompt">Additional comments or questions? </div></td>
    <td align="" ; colspan="2">
    <cftextarea name="comments" rows="4" cols="24"></cftextarea></td>
    </tr>
    <tr>
    <td colspan="2" align="left"><input type="image" src="images/submit.jpg" alt="Submit">
    <br />
    <br />
    <span class="style31">*</span><span class="style27"> Required </span></td>
    </tr>
    </table>
    </cfform>
    <CFELSE>
    <CFIF NOT isDefined("Form.FirstName")><CFSET Form.FirstName = ""></CFIF>
    <!--cfstoredproc code was here--!>

    <CFMAIL TO="email@email.com" subject="VOLUNTEER: Lead received from Example.com" from="noreply@example.com">
    Please contact #form.firstname#<cfif form.firstname IS NOT ""> #form.middlename# #form.lastname#</cfif> via phone at #form.phonenumber# or e-mail at #form.emailAddress#.
    Gender: #form.gender#
    alt. Phonenumber 1: #form.altphonenumber1#
    alt. Phonenumber 2: #form.altphonenumber2#
    Street: #form.street#
    City: #form.city#
    State: #form.state#
    Zipcode: #form.zipcode#
    country: #form.country#
    Birthdate: #form.birthdate#
    race: #form.race#
    height(ft): #form.heightft#
    height(in): #form.heightin#
    weight(lb): #form.weightlb#
    Tobacco use: #form.tobaccouse#
    type of tobacco: #form.tobaccoyes#
    Year Quit: #form.tobaccoquit#
    Chronic Medical Conditions: #form.chronicconditions#
    List of Medications: #form.medications#
    Female Volunteers Only: #form.femaleonly#
    Child bearing potential: #form.childbearing#
    Food or medication allergies: #form.allergies#
    Dietary Requirements: #form.dietaryrequirements#
    Specific study: #form.specificstudy#
    Where did you hear about us: #form.hearaboutus#
    They left the following comments:
    #form.comments#
    </CFMAIL>
    <font color = "red"><b>Thank you for registering.<br />
    An email will be sent shortly.</font></b><br /><br />
    <a href="database.cfm">Click here to go back.</a>
    </CFIF></td></tr></table></td>

  7. #7
    Join Date
    Oct 2005
    Posts
    481
    Hi,

    The problem is that you have multiple form tags. Don't close the form that contains the action for database.cfm and don't open a new <form> tag for every new field. In other words, remove all opening form tags except for the one with the action to database.cfm and remove all closing </form> tags except for the very last one.

    Edit: Never mind. I didn't read through all of your code. I'm not familiar with how Cold Fusion works or a <cfform> tag. However, it still seems that you have too many forms with no action.
    Last edited by kelly23; 03-16-2010 at 12:08 PM.

  8. #8
    Join Date
    Mar 2010
    Location
    Minneapolis
    Posts
    32
    Awesome thanks Kelly23.
    I just tried it out, and now it works perfect

    would you happen to know how to get the form to stay on the page after submitting?

  9. #9
    Join Date
    Jan 2010
    Posts
    24
    Quote Originally Posted by dominicbelfiori View Post
    Awesome thanks Kelly23.
    I just tried it out, and now it works perfect

    would you happen to know how to get the form to stay on the page after submitting?
    you need to use PHP
    PHP makes form making 100 times easier

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles