Solved

Text Color

Posted on 2003-11-29
5
251 Views
Last Modified: 2013-12-24
Dear Experts,

I have a dynamic field that will be either High, Medium or low. Need to know how to change the text color based on the value. High=Red, Medium=Black, Low=Yellow.

Best regards,
AJ
0
Comment
Question by:aj10101
5 Comments
 
LVL 17

Accepted Solution

by:
anandkp earned 200 total points
ID: 9844518
Hi,

<cfset dynamic_field_value = "High"> <!--- this variable is set dynamically based on ur code ... i am assuming the value to be set as high for this example --->

<font face="verdana" size="2" color="<cfif comparenocase(dynamic_field_value,'high') eq 0>red<cfelseif comparenocase(dynamic_field_value,'medium') eq 0>black<cfelse>yellow</cfif>">
anandkp
</font>

hth

let me know

K'Rgds
Anand

PS : u can also use CFSWITCH CASE - if ur comfortable using it.
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 9846861
I was thinking more like something simpler like

<cfparam name="priority" default="medium"> <!--- you can leave this out if you don't need a default --->

<style type="text/css">
<!--
.high {
      color: #FF0000;
}
.medium {
      color: #000000;
}
.low {
      color: yellow;
}
-->
</style>


<span class="#priority#">Your text</span>
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 9847049
You can also have it this way :

<cfparam name="txtcolor" default="red">
<cfparam name="dynamicfld default"High">

<cfswitch expression="#dynamicfld#">
  <cfcase value="Medium">
    <cfset txtcolor="black">
  </cfcase>
  <cfcase value="Low">
    <cfset txtcolor="yellow">
  </cfcase>
  <cfdefaultcase>
  </cfdefaultcase>
</cfswitch>

<cfoutput>
  <input type="text" name="textfield" value="#dynamicfld#" style="font color:#txtcolor#;">
</cfoutput>

The value of the textfield will depend on the value being set to the parameter "dynamicfld".

Goodluck!
eNTRANCE2002 :-)
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9881724
hello ???
0
 

Author Comment

by:aj10101
ID: 9883254
anandkp,

thanks for the help.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

861 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

21 Experts available now in Live!

Get 1:1 Help Now