Ask a Question related to Macromedia ColdFusion, Design and Development.
-
AkronNick #1
Pre Fill list menu with multiple selections
Anybody tell me why this code is not working? I've tried it like every which
way I can possibly think of but I can't get the values to show up as selected.
Help!?
<select name="partJobTitle" class="directoryselects" id="partJobTitle"
multiple height"4">
<cfoutput query="JobTitles">
<option value="#JobTitles.jobtitleName#"
<cfloop list="get_username.Title" delimiters="," index="i">
<cfif JobTitles.jobtitleName IS "i">selected</cfif></cfloop></cfoutput>>#JobTitles.jobtitleName#</option>
</select>
AkronNick Guest
-
Mail values from a List with Multiple Selections with PHP
Hi, I have a little problem, I have a HTML-mailform with a List/Menu (named informatie) witch allows Multiple Selections (Hold CTRL-key and... -
Multiple Dynamic List Menu Help
Hello. I'm a programming novice and I'm trying to create a two dynamically populated list and or jump menus. I'd like there to be a parent / child... -
multiple menu/list values inserted into one mysql column
Simple problem here for the pros I'm sure. I have constructed a "rockshow" database in mysql for local music artists/bands and I made an input form... -
Filemaker mobile, list/menu and multiple entries...
On the desktop shift click selects multiple, is there an equivalent palm action in FM Mobile to enter multiple items from a menu or list? This may... -
display list box selections and use for combo box
I have a list box in which users will make one to several selections. When the user is finished making selections, I need to display them in a... -
Jon Block #2
Re: Pre Fill list menu with multiple selections
<cfif JobTitles.jobtitleName IS 'i'> You're testing 'i' like it's a string...
i doubt you're really checking to see if someone's job title is 'i'. You want
to check for i as a variable.. not as a literal string. I'd do it like this:
<cfif JobTitles.jobtitleName eq i> other ways of doing it would be: <cfif
JobTitles.jobtitleName IS '#i#'> <cfif JobTitles.jobtitleName eq #i#> -Jon
Jon Block Guest
-
AkronNick #3
Re: Pre Fill list menu with multiple selections
Right, I understand what you are saying about string literals, etc.. And I have
tried all the possible ways of doing it and it does not work the other 2 ways
you suggested either... I had already tried those ways but did try again after
your post. Any other ideas by chance?
AkronNick Guest
-
Jon Block #4
Re: Pre Fill list menu with multiple selections
jobtitles.jobtitlename obviously doesn't equal #i#. Just make a page that
prints out each of the values. If they do match, look closely at the HTML
output when you run the page...maybe theres a typo in your select elment. Jon
Jon Block Guest
-
AkronNick #5
Re: Pre Fill list menu with multiple selections
I've ran that test, the values print fine.. still no luck comparing and getting
them selected. The values I compare to come straight from a database table, I
know for sure all the values would match up... Seriously frustrating here
AkronNick Guest
-
SafariTECH #6
Re: Pre Fill list menu with multiple selections
Is the question 'why won't the names populate?' or os it 'why won't it select
the appropriate name?' You both seem to be going over the 'i' validation,
which is merely a loop to select a certain name, not the portion that actually
populates the names in the dropdown. If you are asking why it is not selecting
a proper name in the list, I suspect it is because you told it the list is
'get_username.Title' (literally). It is not looking at 'get_username.Title' as
a variable, but rather an entry. It should be '#get_username.Title#' if you
want it to use a pre-populated variable containing a comma-delimited list.
There is no reason for the names themselves, not to actually populate.
SafariTECH Guest
-
AkronNick #7
Re: Pre Fill list menu with multiple selections
Populating the list is not the issue. I populate the list with a db table
column of values. Then, I check a comma delimited list to see if any of the
values in the comma delimited list equal any of the values in the populated
list, if they do they should be selected. It's an 'update' form... so I want
to prefill all the form with the existing values of the record I am updating.
AkronNick Guest
-
SafariTECH #8
Re: Pre Fill list menu with multiple selections
Then, as I stated, make sure you use the pound signs on your list variable,
otherwise it reads it literally as the actual list and not as a variable
containing a list. variable = 'name1,name2,name3,name4' list = 'variable'
means the list contains 'variable' list = '#variable#' means the list contains
'name1,name2,name3,name4' Your list variable has no pound signs in your
example
SafariTECH Guest
-
AkronNick #9
Re: Pre Fill list menu with multiple selections
I thought I was crazy for a second.. Man.. Thank you for the help both of you.
No pound signs around my list, DUH, it was taking the entire comma delimited
list and comparing that. OK, working now thanks for the help.. below code is
what works:
<select name="partJobTitle" class="directoryselects" id="partJobTitle"
multiple height"4">
<cfoutput query="JobTitles">
<option value="#jobtitleName#"
<cfloop list="#get_username.Title#" delimiters="," index="i">
<cfif #jobtitleName# IS #i#>selected</cfif></cfloop></cfoutput>>#jobtitleName#</option>
</select>
AkronNick Guest



Reply With Quote

