Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2011-03-01
9
Medium Priority
?
1,145 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 1000 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 53

Accepted Solution

by:
_agx_ earned 1000 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
Industry Leaders: 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 53

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 53

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

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
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 …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

578 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