The value of formatPreference returned from the bean is "html". Here is the
output generated by the tag:

 <select name="formatPreference" id="formatPreference"> <option value=""
id="formatPreference_">Select Format Preference</option>
<option value="html" id="formatPreference_html">HTML</option>
<option value="text" id="formatPreference_text">Text</option>
</select>

I see the value of attributes.checkValue is also coming as "html" in
option.cfm.

I did looked at options.cfm and then ended up in option.cfm because I saw
that setAttribute("selected", "selected") is called in there. I will go back
and see if I can find anything else in options.cfm

Thanks,
Sumit

On Sun, Jan 10, 2010 at 10:39 PM, Peter J. Farrell <[email protected]>wrote:

> What does the data look like that "formatPerference" return from your user
> bean?  If it is a list or array -- it uses the items from the list/array
> elements to match to the names of the select items.  So if you have the
> items of "red,green,blue" -- the list/array will select by matching the item
> names.  Therefore a list/array with the values of "red,blue" will select
> those options.  The select option item value matches an element in the the
> list or array -- it is like saying "true".
>
> If "formatPeference" from the user returns a struct, then it uses the key
> of struct to check against a boolean.  Using the example above to have "red"
> and "blue" selected -- the struct would have to look have booleans like
> this:
>
> red = true
> green = false
> blue = true
>
> To answer your question:
>
>  But, when I tried to output the value of attribute.value before that
>> line and I get "${output.value}", which I'm guessing gets replaced
>> some other place with the proper value.
>>
> When you use the "items" attribute of the select tag, it uses the "options"
> tag in the form library.  We use the "option" (not plural) to generate a
> template for the "options (plural) and that is why you are seeing the
> placeholder "${output.value}" in which the "options" tag uses a Replace() on
> the template.  This is for performance -- calling "option" (not plural) in a
> loop is about 10 times slower on large select lists.  Check out the
> "options" (plural) tag if you want to dig into that code.
>
> Best,
> .Peter
>
>
> Sumit Verma said the following on 10/01/10 21:22:
>
>  Hi Guys,
>>
>> It looks like the form:select tag does not select the value defined in
>> the binding. Not sure if I'm missing something here. Here is my code:
>>
>> <cfset variables.formatPreferenceOptions = {html="HTML", text="Text"} /
>>
>>
>>>
>>>
>> <form:form actionEvent="" bind="users">
>>        <form:select path="formatPreference"
>> items="#variables.formatPreferenceOptions#">
>>                <form:option value="" label="Select Format Preference" />
>>        </form:select>
>> </form:form>
>>
>> I see that the selected attribute is set on option.cfm in line 76.
>>        <cfif ListFindNoCase(attributes.checkValue, attributes.value)>
>>                <cfset setAttribute("selected", "selected") />
>>        <cfelse>
>>                <cfset setAttributeIfDefinedAndTrue("selected", "selected")
>> />
>>        </cfif>
>>
>> But, when I tried to output the value of attribute.value before that
>> line and I get "${output.value}", which I'm guessing gets replaced
>> some other place with the proper value.
>>
>> As always, thanks in advance for the help!
>> Sumit
>>
>>
>
>
> --
> You received this message because you are subscribed to Mach-II for CFML
> list.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
> SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
> Wiki / Documentation / Tickets:
> http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/
>
-- 
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets: 
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/

Reply via email to