Solved

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

Posted on 2011-03-01
9
1,100 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Shockwave Flash Object within PowerPoint 2013 2 130
Web browser crash when play videos 24 290
ColdFusion Rereplace 3 80
Coldfusion / Railo 4 -  datetimeFormat problem 3 26
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

809 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