Solved

Change style of CFSELECT within a CFFORM (format='FLASH') using CFIF

Posted on 2011-03-01
9
1,096 Views
Last Modified: 2012-05-11
I am trying to change the style of the values within a CFSELECT based on certain criteria of that record in the query.  

ID             Location                        BU
1             Harrisburg                   B,M,W
2              Orlando                       B
3              Austin                          B,W
4              Atlanta                          M
5              Miami                           M,W

Based on the example table above, if the Business Unit is M, then I want that location to show up in the CFSELECT as Blue...the rest, show in Black.      

With the code that I have below, my flash form just doesn't load.  I don't get any CF errors, the form just doesn't load.  
<!---- this is the cfform ---->

<cfform format="flash" 
	name="myFORM"
	action=""
	method="POST"
	skin="haloOrange">
<cfformgroup type="vdividedbox" id="DetailsBox02">	
<cfselect 
NAME="selLoc"
query="get_Locations"
display="Location"
value="ID"
multiple="yes"
size="11"
CLASS="tiny"
style="<cfif ListFind(#get_Locations.BU#, 'M')>color:blue;<cfelse>color:black;</cfif>"
width="233" 
label="Location(s):"
tooltip="To select multiple locations, hold down the Ctrl button and click the name">
</cfselect>
</cfformgroup>
</cfform>

Open in new window

0
Comment
Question by:Lee R Liddick Jr
  • 5
  • 3
9 Comments
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 250 total points
ID: 35009510
You need to take out the query attributes and do it inside a loop so you have control over each option tag...


<cfselect 
NAME="selLoc"
multiple="yes"
size="11"
CLASS="tiny"
style="<cfif ListFind(#get_Locations.BU#, 'M')>color:blue;<cfelse>color:black;</cfif>"
width="233" 
label="Location(s):"
>

<cfoutput query="get_Locations">
  <cfset myStyle="color:black;"> 
 <cfif listFind(getLocations.bu,"M")>
   <cfset myStyle="color:blue;"> 
 </cfif>
 <option style="#myStyle#" value="#getLocations.ID#"> #getLocations.Location# </option>
</cfoutput>
</cfselect>

Open in new window

0
 

Author Comment

by:Lee R Liddick Jr
ID: 35010052
Okay, the flash form is appearing now, but my style doesn't change in the CFSELECT.  This is what I now have.
<cfselect NAME="selLoc"
  multiple="yes"
  size="11"
  CLASS="tiny"
  width="233" 
  label="Locations(s):"
  tooltip="To select multiple locations, hold down the Ctrl button and click the name">
<cfoutput>
<cfloop query="get_locations">

  <cfset myStyle="color:black;"> 
 <cfif listFind(getLocations.bu,"M")>
   <cfset myStyle="color:blue;"> 
 </cfif>
 <option style="#myStyle#" value="#get_locations.ID#">#get_locations.location#</option>
</cfloop>
</cfoutput>
</cfselect>

Open in new window

0
 
LVL 52

Accepted Solution

by:
_agx_ earned 250 total points
ID: 35010128
<option style="#myStyle#" value="#get_locations.ID#">

I don't think that works for flash forms, only html.

I know how to set the bgColor for list <options> but no the "text" color unfortunately :)
0
 

Author Comment

by:Lee R Liddick Jr
ID: 35010205
That's not good...
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Assisted Solution

by:Lee R Liddick Jr
Lee R Liddick Jr earned 0 total points
ID: 35010274
Okay, since I apparently am not able to style the text color within the flash form, I am just adding an '*' at the end of my value to designate it.  Thanks for the help...
<cfselect NAME="selLoc"
  multiple="yes"
  size="11"
  CLASS="tiny"
  width="233" 
  label="Locations(s):"
  tooltip="To select multiple locations, hold down the Ctrl button and click the name">
<cfoutput>
<cfloop query="get_locations">
<option style="#myStyle#" value="#get_locations.ID#">#get_locations.location#<cfif ListFind(#get_locations.BU#, 'M')>*</cfif></option>
</cfloop>
</cfoutput>
</cfselect>

Open in new window

0
 
LVL 52

Expert Comment

by:_agx_
ID: 35010321

Okay, since I apparently am not able to style the text color within the flash form


Btw: I'm specifically talking about styling list <options> *separately*.  If you just want to style the whole list, that's doable.
0
 

Author Comment

by:Lee R Liddick Jr
ID: 35010810
And I don't want to style the entire list...I only want to style specific values of the query.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 35011031
Ok, that's what I thought.  Styling the list is supported, but not the individual <option>'s afaik.  

Hacking flash forms is a pain if you're not a flex/a.s. guru. (I'm not).  There's a hack for changing the bgColor. But I'll be darned if I can figure out the one for text color..
0
 

Author Closing Comment

by:Lee R Liddick Jr
ID: 35045624
Since it's not really working the way I wanted, I modified my code to make it work visually by using an '*' instead of a color change.  I provided points to you both for your assistance.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to record live broadcast.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now