|
Loading...
|
cfwheels@googlegroups.com
[Prev] Thread [Next] | [Prev] Date [Next]
[cfwheels] Re: select() George Tue Feb 21 13:01:07 2012
options = [{YES = "1"}, {NO = "2"}]
seems to work just fine. However (not a big deal), but the YES, NO
values are lower case in my select box.
On Feb 21, 2:38 am, JayKufner <[EMAIL PROTECTED]> wrote:
> This works: Create an array like this in the options :
> [{one = "1"}, {two = "2"}].
>
> So your example:
>
> #select( objectName="user", property="empActive", label="Employee Site
> Active", options = [{Yes = "1"}, {no = "2"}] )#
>
> If you Have real large list that you don't want to hard code by hand, you
> could write a helper function that does something like this (don't forget
> to var your variables where appropriate):
>
> <cfset list = "one,two,three,four,five,six,seven,eight,nine,ten" />
> <cfset list2 = "1,2,3,4,5,6,7,8,9,10" />
> <cfset arrayOfObjects = []/>
>
> <cfloop from="1" to="#listLen(list2)#" index="i">
> <cfset arrayAppend( arrayOfObjects,
> {#listGetAt(list,i)#="#i#"} ) />
> </cfloop>
>
> This will create an array of objects, you can use it as the options value
> of your select function:
>
> #select(
> objectName = "user",
> property = "empActive",
> options = arrayOfObjects
> )#
>
> Hope that helps!
--
You received this message because you are subscribed to the Google Groups
"ColdFusion on Wheels" group.
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/cfwheels?hl=en.
- [cfwheels] select() George 2012/02/20
- [cfwheels] Re: select() JayKufner 2012/02/21
- [cfwheels] Re: select() George 2012/02/21 <=
- Re: [cfwheels] Re: select() Andy Bellenie 2012/02/22
- Re: [cfwheels] Re: select() Tom King 2012/02/22