WOW, thx for all the great responses...... Matthew Doepel MGD Strategic Business Solutions T: +61.2.9360.1555 | M: +61.417.88.55.44 F: +61.2.9380.6777 A: PO Box 1194, Darlinghurst, NSW 1300 E: [EMAIL PROTECTED] | W: www.mgd.com.au
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of TRACEY, Darren Sent: Wednesday, 23 June 2004 11:40 To: CFAussie Mailing List Subject: [cfaussie] RE: PRE-SELECTED Drop Down List I would also add to this code that this line: <option value="" selected>Select a Street Type</option> should be changed to this: <option value="" <cfif NOT isdefined("FORM.StreetTypeID")>selected</cfif>>Select a Street Type</option> Another thing I've used in the past is to make the selected items 'float' to the top of the list in the drop down. This makes it easier for the user to find selected items, especially if the list is long and multiple items are selected, and helps stop them accidentally clicking on a value and losing the selection on items way down the list that they were not aware of. You'd do it something like this: <select name="StreetTypeID" tabindex="18"> <option value="" <cfif NOT isdefined("FORM.StreetTypeID")>selected</cfif>>Select a Street Type</option> <!--- Loop through and output selected options ---> <cfoutput query="qStreetTypes"> <cfif isdefined("FORM.StreetTypeID") and FORM.StreetTypeID eq qStreetTypes.StreetTypeID> <option value="#qStreetTypes.StreetTypeID#" selected>#qStreetTypes.StreetType#</option> </cfif> </cfoutput> <!--- Loop through and output non selected options ---> <cfoutput query="qStreetTypes"> <cfif NOT (isdefined("FORM.StreetTypeID") and FORM.StreetTypeID eq qStreetTypes.StreetTypeID)> <option value="#qStreetTypes.StreetTypeID#">#qStreetTypes.StreetType#</option> </cfif> </cfoutput> </select> The only other thing I'd add would be that you should qualify your query values, ie instead of referring to the query values like this: StreetType you really should be referring to them like this: qStreetTypes.StreetType It helps the CF engine find the value faster, avoids any confusion the engine (or the developer) may have about which scope the variable came from, and makes it a lot easier to maintain the code. My example would be this: Your original code put a variable called: StreetTypeID into the option's value parameter. Will CF use: qStreetTypes.StreetTypeID OR FORM.StreetTypeID for this value? I know you want the query value, but are you sure about which scope CF will use first? It pays to be specific. Regards Darren Tracey Systems Analyst Web Applications p: + 61 7 3232 4091 (x64091) f: + 61 7 3232 4022 e: [EMAIL PROTECTED] > l: Lvl 5, 388 Queen St Brisbane QLD 4000 > > > -----Original Message----- > From: Clifton Steve [SMTP:[EMAIL PROTECTED] > Sent: Wednesday, 23 June 2004 11:08 > To: CFAussie Mailing List > Subject: [cfaussie] RE: PRE-SELECTED Drop Down List > > <select name="StreetTypeID" tabindex="18"> > > <option value="" selected>Select a Street > Type</option> > > <cfoutput query="qStreetTypes"> > > <option value="#StreetTypeID#"<cfif > isdefined("FORM.StreetTypeID") and FORM.StreetTypeID eq > qStreetTypes.StreetTypeID> selected</cfif>>#StreetType#</option> > > </cfoutput> > > </select> > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Matthew > Doepel > Sent: Wednesday, 23 June 2004 10:51 AM > To: CFAussie Mailing List > Subject: [cfaussie] PRE-SELECTED Drop Down List > > > > I want a user to select a value from a drop down list on form 1, > then preselect that value in the same list on the next form, Anyone help? > > > > Drop down list query : > > > > <CFQUERY NAME="qStreetTypes" DATASOURCE="SalesAccounts"> > > SELECT StreetTypes.StreetTypeID, > StreetTypes.StreetType > > FROM StreetTypes > > ORDER BY StreetTypes.StreetType > > </CFQUERY> > > FORM 1: > > <select name="StreetTypeID" tabindex="18"> > > <option value="" selected>Select a Street > Type</option> > > <cfoutput query="qStreetTypes"> > > <option > value="#StreetTypeID#">#StreetType#</option> > > </cfoutput> > > </select> > > > > FORM 2: This is where I want the list to preselect the value from > form 1 using #FORM.StreetTypeID# > > > > <select name="StreetTypeID" tabindex="18"> > > <option value="" selected>Select a Street > Type</option> > > <cfoutput query="qStreetTypes"> > > <option > value="#StreetTypeID#">#StreetType#</option> > > </cfoutput> > > </select> > > > > Matthew Doepel > > MGD Strategic Business Solutions > > T: +61.2.9360.1555 | M: +61.417.88.55.44 > > F: +61.2.9380.6777 > > A: PO Box 1194, Darlinghurst, NSW 1300 > > E: [EMAIL PROTECTED] | W: www.mgd.com.au > > > > --- > You are currently subscribed to cfaussie as: [EMAIL PROTECTED] > To unsubscribe send a blank email to > [EMAIL PROTECTED] Aussie Macromedia Developers: > http://lists.daemon.com.au/ > Register now for the 3rd National Conference on Tourism Futures, being > held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf > > > --- > You are currently subscribed to cfaussie as: [EMAIL PROTECTED] > To unsubscribe send a blank email to > [EMAIL PROTECTED] Aussie Macromedia Developers: > http://lists.daemon.com.au/ ----------------------------------------------------------------------------------- This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its related entities ("Suncorp"). Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 1800 689 762 or at suncorp.com.au. The content of this e-mail is the view of the sender or stated author and does not necessarily reflect the view of Suncorp. The content, including attachments, is a confidential communication between Suncorp and the intended recipient. If you are not the intended recipient, any use, interference with, disclosure or copying of this e-mail, including attachments, is unauthorised and expressly prohibited. If you have received this e-mail in error please contact the sender immediately and delete the e-mail and any attachments from your system. If this e-mail constitutes a commercial message of a type that you no longer wish to receive please reply to this e-mail by typing Unsubscribe in the subject line. --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
