Solved

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

Posted on 2011-03-01
9
1,121 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

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…
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 shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

691 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