I found a hokey solution by passing the value I want selected to the cfc in the
bind and doing an arrayInsertAt to position 1 of the array.
if(len(pTypeSelected)){
arrayInsertAt(aPropertyTypes,1,arrayNew(1));
aPropertyTypes[1][1] = pTypeSelected;
aPropertyTypes[1][2] = pTypeSelected;
}
Azadi - 28 Aug 2007 06:00 GMT
good job!
but is it actually selected in the cfselect?
i mean, if it is just the first element in the select box, it is not
necessarily 'selected', as in: its value is the value of the
form.selectbox... or is it?
but even if not, i suppose you could always employ a little javascript
to make the first element in select box 'selected' on page load....

Signature
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
The first value in the list is selected by default if none are marked as
'selected'. As I said, this is hokey and there has to be a better way.
I have run into a situation where I have a multiple select box and I need
multiple selections automatically selected.
Any ideas?
Anyone?
Azadi - 29 Aug 2007 05:27 GMT
> I have run into a situation where I have a multiple select box and I need
> multiple selections automatically selected.
>
> Any ideas?
i think binding will not let you do this...
but then again i do not think your multiple select will be the second
select in a chain of related selects, right? it is probably the first
(or the only) select box?
if so, then you could return a comma-delimited list of values (the ones
to be pre-selected) from your cfc, and then have a regular select
element populated with regular option elements which are inside a cfloop
to check if the value of current option element is in the list passed
form cfc, and set selected=selected if it is...

Signature
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Azadi - 19 Sep 2007 06:54 GMT
> The first value in the list is selected by default if none are marked as
> 'selected'. As I said, this is hokey and there has to be a better way.
[quoted text clipped - 5 lines]
>
> Anyone?
follow-up:
anyone still looking for solution to this:
good old fellas ray camden and tod sharp have solved it
here:
http://www.coldfusionjedi.com/index.cfm/2007/8/7/Selecting-default-items-using-C
oldFusion-8s-AJAX-Controls
and here:
http://cfsilence.com/blog/client/index.cfm/2007/8/7/Selecting-Multiple-Default-I
tems-With-ColdFusion-8-Ajax-Controls

Signature
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com