| Posted By |
Discussion Topic: displaying results from a drop down menu
|
|
devondago |
04-09-2003 @ 4:08 PM |
|
|
New Member
Posts: 38
Joined: Feb 2003
|
I have the following drop down selection <td><b><font face="Verdana" size="2" color="#000000">Classes</b></td> <td> <select name="abbrv"><cfoutput query="getava"><option value="#abbrv_id#" >#name#</option></cfoutput></select> </td></tr> this is displaying event names. I need to get these events display on the following table when the user selects an event from the dropdown menu this is my table where i am displying the event info where they can sign up for it. right now i have all events coming in this way. can someone help me get this the right way. PLEASE!!!!! <cfif listfind(validation_error, "choice")> <p><font color="red">Please select one of the following classes.</font></p> </cfif> <br> <br> <table border=1 bordercolor="00308F" cellspacing=0 cellpadding=5> <tr> <th align=left><font face="Verdana" size="2" color="#000000">CLASS </font></th> <th><font face="Verdana" size="2" color="#000000">DATE</font></th> <th><font face="Verdana" size="2" color="#000000">TIME</font></th> <th><font face="Verdana" size="2" color="#000000">LOCATION</font></th> <th colspan="2" align="center"><font face="Verdana" size="2" color="#000000">SELECT</font></th> </tr> <cfoutput query="getava"> <tr> <td><font face=Verdana size=2 color=00308F>#name#</font></td> <td><font face=Verdana size=2 color=00308F>#Dateformat(cdt,'mm/dd/yyyy')#</font></td> <td><font face=Verdana size=2 color=00308F>#chour#</font></td> <td><font face=Verdana size=2 color=00308F><b>#loc_descr#</font></b></td> <td><font face=Verdana size=2 color=cc0000><b>#seats# <cfif seats gt 0> <input type="radio" value="#cal_id#" name="choice" <cfif choice eq cal_id>checked</cfif>> <cfelse> This class is not available. </cfif></font></b></td> </tr> </cfoutput> </table> <br> <input type="submit" name="Submit Registration"> </form>
|
CJ |
04-09-2003 @ 4:27 PM |
|
|
Administrator
Posts: 4262
Joined: Oct 2002
|
you're trying to do this all on one page? eg change the select option and have the table data change dynamically? do-able...but it'll take some DHTML. you'll need to create a js array based on the query results and add an onchange event to your select that calculates the selected index, pulls the appropriate array position, and displays it in the table. Or, you can have the page submit via the onchange event, and load the appropriate data in the table using the form.abbrv value in your query to pull the appropriate record. Which way were you looking to go?
|
devondago |
04-09-2003 @ 4:58 PM |
|
|
New Member
Posts: 38
Joined: Feb 2003
|
I hope you can help me... here is what i have so far... a form whre users can register to events. I was displaying all the events. Now I need to add a drop down box where you can select an event and base on that selection the event table will populate base on that selected event. As of now all the events are being display but i need to display them base on the criteria i mention. Once you select the event and the user fills out the form i have another form call inset form where i was inserting my values and sending a confirmation page. I know that base on this new selection box everything is going to change but i dont know the logic to doing this with adding this select box. here is my input form <html> <head> <title>Registration</title> </head> <body> <cfparam name="choice" default="0"> <cfparam name="validation_error" default=""> <cfinclude template="validate.cfm"> <cfset #adminemail# = "ltrujillo@mhs.net"> <!---<cftry> ---> <cfquery name="getava" datasource="west80139"> select * from calwest c, calwest_abbrvs a ,calwest_loc l where c.abbrv = a.abbrv_id and c.loc = l.loc_id order by cdt </cfquery> <form action="insertform.cfm" method="post"> <table width=500 border=0> <td><b><font face="Verdana" size="2" color="#000000">Classes</b></td> <td> <select name="classes"><option value="-----" >======</option> <option value="1" >FB</option> <option value="2" >HP</option> <option value="3">SCB</option> </select> </td></tr> <br> <tr><td><font face="verdena" size="2">First Name</font></tr></td> </td><td><input type="Text" name="fname" message="Please enter your first name." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="verdena" size="2">Last Name</font></tr></td> </td><td><input type="Text" name="lname" message="Please enter your last name." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Email </font></tr></td> </td><td><input type="Text" name="email" message="Please enter your email address." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Telephone</font></tr></td> </td><td><input type="Text" name="phone" message="Please enter your phone number in XXX-XXX-XXXX format." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Alternate Telephone</font></tr></td> </td><td><input type="Text" name="altphone" message="Please enter your phone number in XXX-XXX-XXXX format." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Address</font></tr></td> </td><td><input type="Text" name="address" message="Please enter your address." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">City</font></tr></td> </td><td><input type="Text" name="city" message="Please enter your city." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">State</font></tr></td> </td><td><input type="Text" name="state" message="Please enter your state." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Zip Code</font></tr></td> </td><td><input type="Text" name="zip" message="Please enter your Zip Code." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Due Date</font></tr></td> </td><td><input type="Text" name="due" message="Please enter your Due Date in a date format." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Birthdate</font></tr></td> </td><td><input type="Text" name="bday" message="Please enter your Birthdate in date format." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="Verdana" size="2">Social Security</font></tr></td> </td><td><input type="Text" name="ssn" message="Please enter your Social Security in a xxx-xx-xxxx format." required="Yes" size="25" maxlength="25"></td></tr> <tr><td> <tr><td><font face="verdana" size="2" >Additional Message</font></tr></td> </td><td><textarea name="message" rows="7" cols="40"></textarea></td></tr> </table> <br> <cfif listfind(validation_error, "choice")> <p><font color="red">Please select one of the following classes.</font></p> </cfif> <br> <br> <table border=1 bordercolor="00308F" cellspacing=0 cellpadding=5> <tr> <th align=left><font face="Verdana" size="2" color="#000000">CLASS </font></th> <th><font face="Verdana" size="2" color="#000000">DATE</font></th> <th><font face="Verdana" size="2" color="#000000">TIME</font></th> <th><font face="Verdana" size="2" color="#000000">LOCATION</font></th> <th colspan="2" align="center"><font face="Verdana" size="2" color="#000000">SELECT</font></th> </tr> <cfoutput query="getava"> <tr> <td><font face=Verdana size=2 color=00308F>#name#</font></td> <td><font face=Verdana size=2 color=00308F>#Dateformat(cdt,'mm/dd/yyyy')#</font></td> <td><font face=Verdana size=2 color=00308F>#chour#</font></td> <td><font face=Verdana size=2 color=00308F><b>#loc_descr#</font></b></td> <td><font face=Verdana size=2 color=cc0000><b>#seats# <cfif seats gt 0> <input type="radio" value="#cal_id#" name="choice" <cfif choice eq cal_id>checked</cfif>> <cfelse> This class is not available. </cfif></font></b></td> </tr> </cfoutput> </table> <br> <input type="submit" name="Submit Registration"> </form> </body> </html> here is my inputform.... <HTML> <HEAD> <CFOUTPUT> <TITLE>Thank you #fname# for your submission!</TITLE> </CFOUTPUT> </HEAD> <BODY> <cfquery name="qUnique" datasource="west80139"> select reg_id from reginfo where uid = reg_id </cfquery> <cftransaction> <cfquery name="qInsert" datasource="west11111" dbtype="ODBC"> INSERT INTO reginfo (fname,lname,email,phone,altphone,address,city,state,zip,due,bday,message,item,uid) values ('#form.fname#','#form.lname#','#form.email#','#form.phone#','#form.altphone#','#form.address#', '#form.city#','#form.state#','#form.zip#', '#form.due#','#form.bday#','#form.message#', #form.choice#, '0') </cfquery> <cfquery name="qUpdate" datasource="west11111" dbtype="ODBC"> update calwest set seats = seats - 1 where cal_id = #choice# </cfquery> </cftransaction> <!--- email to FBP admin ---> <CFMAIL TO="ltrujillo@mhs.net" FROM="#form.email#" SUBJECT="Registration Submission from website!" type="html" > Registration form submission <br> name: #form.fname# #form.lname#<br> class:#form.choice#<br> email: #form.email#<br> IP: #REMOTE_ADDR#<br> Comments: #Message#<br> </CFMAIL> <!--- to person who register ---> <CFMAIL FROM="l@yahho.cm" TO="#form.email#" SUBJECT="Thank you for submitting your registration!"> Dear #fname#: Thank you for registring to the FB Clases. Your registration has been forwarded to our class specialist. If you class is reschedule or canceled, you will be contacted with other options. Thanks Again, FBC Registration Specialist, FB MHW FBC Numbers: Memorial Hospital Pembroke (xxx) xxx-xxxx Memorial Hospital West (xxx) xxx-xxxx Memorial Regional Hospital (xxx) xxx-xxxx Submission Receipt: =========================================================== name: '#form.fname#''#form.lname#' email: '#form.email#' IP: '#REMOTE_ADDR#' Message: #Message# Message Sent: #DateFormat(now(), 'mmmm dd, yyyy')# #TimeFormat(Now(), 'hh:mm:ss tt')# </cfmail> <!--- display ---> <CFOUTPUT> Thank you #form.fname#,<br> we have successfully received your registration request and it's been sent to the coresponding support personnel. Expect to hear from us within 24 hours. A copy of this form submission was also sent to the email address you specified as being yours in the previous page for your records.<BR> <BR> Thanks,<BR> FBBR> MHW </CFOUTPUT> <br> <font face="Verdana" color="003399" size="2"><a href="javascript:this.close()">Click here</a> to close this window</font> </BODY> </HTML> I appreciate all the help!
|
|