freelanceprogrammers.org Forum Index » Cold Fusion

Multiple values in 1 drop-down menu?


View user's profile Post To page top
rgpg_99 Posted: Fri Nov 04, 2005 10:02 am


Joined: 01 Apr 2005

Posts: 16
Multiple values in 1 drop-down menu?
Hi all,

I have a drop-down menu where users choose a branch name with this code:

<option value="#BranchNameFull#">#BranchNameFull# (#BranchNameAbbr#)</option>

Now, if I want to send both the "BranchNameFull" and the "BranchNameAbbr"
values to the database, is there a way of doing that with multiple value
setting, hidden fields within the drop-down menu, or other tricks of that sort?

Thanks in advance,

Roberto Perez
Reply with quote
Send private message
View user's profile Post To page top
reardenweb Posted: Fri Nov 04, 2005 6:44 pm


Joined: 04 Nov 2005

Posts: 2
Multiple values in 1 drop-down menu?
There are a couple of ways to do this. You could use a delimeter in the value (ie. option value="#BranchNameFull#;#BranchNameAbbr#"), then loop over the form field and seperate the values based on the ;. Or you could send the #BranchNameFull# value to your form processing page and do a quick query for the BranchNameAbbr value based on the BranchFullName value. This will only work if they are stored in a database already.

On 11/3/05, Roberto Perez <rgpg@...> wrote:
Hi all,I have a drop-down menu where users choose a branch name with this code:<option value="#BranchNameFull#">#BranchNameFull# (#BranchNameAbbr#)</option>
Now, if I want to send  both the "BranchNameFull" and the "BranchNameAbbr"values to the database, is there a way of doing that with multiple valuesetting, hidden fields within the drop-down menu, or other tricks of that sort?
Thanks in advance,Roberto Perez------------------------ Yahoo! Groups Sponsor --------------------~-->Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/HKFolB/TM--------------------------------------------------------------------~->Yahoo! Groups Links
<*> To visit your group on the web, go to:   http://groups.yahoo.com/group/cold_fusion/<*> To unsubscribe from this group, send an email to:
   cold_fusion-unsubscribe@yahoogroups.com<*> Your use of Yahoo! Groups is subject to:   http://docs.yahoo.com/info/terms/
Reply with quote
Send private message
View user's profile Post To page top
rgpg_99 Posted: Fri Nov 04, 2005 7:17 pm


Joined: 01 Apr 2005

Posts: 16
Multiple values in 1 drop-down menu?
At 07:44 AM 11/4/2005, Christopher McGrath wrote:

>There are a couple of ways to do this. You could use a delimeter in the
>value (ie. option value="#BranchNameFull#;#BranchNameAbbr#"), then loop
>over the form field and seperate the values based on the ;. Or you could
>send the #BranchNameFull# value to your form processing page and do a
>quick query for the BranchNameAbbr value based on the BranchFullName
>value. This will only work if they are stored in a database already.


Yes, the values are already stored in a database. I like the first idea,
though, because I assume it saves me an additional query to the database
(which the second system would entail). Could you post a snippet of code of
the loop to separate the values (a technique I`m not familiar with)?

Thanks in advance,

Roberto
Reply with quote
Send private message
View user's profile Post To page top
reardenweb Posted: Fri Nov 04, 2005 10:01 pm


Joined: 04 Nov 2005

Posts: 2
Multiple values in 1 drop-down menu?
Try this:
--On Form Page--
<option name="Branch" value="#BranchNameFull#,#BranchNameAbbr#">
 
--On Processing Page--
<cfset BranchNameFull = #trim(listGetAt(form.Branch, 1))#><cfset BranchNameAbbr = #trim(listGetAt(form.Branch, 2))#>
 
Then insert BranchNameFull and BranchNameAbbr into your database. 
On 11/4/05, Roberto Perez <rgpg@...> wrote:
At 07:44 AM 11/4/2005, Christopher McGrath wrote:>There are a couple of ways to do this. You could use a delimeter in the
>value (ie. option value="#BranchNameFull#;#BranchNameAbbr#"), then loop>over the form field and seperate the values based on the ;. Or you could>send the #BranchNameFull# value to your form processing page and do a
>quick query for the BranchNameAbbr value based on the BranchFullName>value. This will only work if they are stored in a database already.Yes, the values are already stored in a database. I like the first idea,
though, because I assume it saves me an additional query to the database(which the second system would entail). Could you post a snippet of code ofthe loop to separate the values (a technique I`m not familiar with)?
Thanks in advance,Roberto------------------------ Yahoo! Groups Sponsor --------------------~-->Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/HKFolB/TM--------------------------------------------------------------------~->Yahoo! Groups Links<*> To visit your group on the web, go to:
   http://groups.yahoo.com/group/cold_fusion/<*> To unsubscribe from this group, send an email to:  
cold_fusion-unsubscribe@yahoogroups.com<*> Your use of Yahoo! Groups is subject to:   http://docs.yahoo.com/info/terms/
Reply with quote
Send private message
View user's profile Post To page top
rgpg_99 Posted: Sat Nov 05, 2005 7:42 am


Joined: 01 Apr 2005

Posts: 16
Multiple values in 1 drop-down menu?
At 11:01 AM 11/4/2005, Christopher McGrath wrote:

>Try this:
>--On Form Page--
><option name="Branch" value="#BranchNameFull#,#BranchNameAbbr#">
>
>--On Processing Page--
><cfset BranchNameFull = #trim(listGetAt(form.Branch, 1))#>
><cfset BranchNameAbbr = #trim(listGetAt(form.Branch, 2))#>
>
>Then insert BranchNameFull and BranchNameAbbr into your database.


Thanks, that worked well! One glitch, though: some of my "full" names have
a comma in them, and the "trim" code stops reading the name at the comma
(so that the full names get clipped). What would the way be to "escape"
that comma so that the name is read properly? Or, instead of a comma as a
separator, can something else be used?

Thanks,

Roberto
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help