Colors in an event page

Posted on 2009-07-15
Last Modified: 2012-05-07
I am not very familiar with CSS/Cold Fusion code.  Let's just say not at ALL familiar.

I have the piece of code below, and basically, when the column on the far right says "OPEN" I want it to be dark green.  When it says "CLOSED" I want it Black.  When it says REAL WORLD, I want it in RED.

Can someone  help rewrite this line to do what I need?  It could be that it's Black unless it says OPEN or REAL WORLD.

Thank you!
as reads:
  <td onclick="rowtoggle(#EventID#);" align="right" <cfif IsOpen is 1>style="color:green">OPEN<br> #calchours# H, #calcminutes# M<cfelse>style="color:grey">CLOSED</cfif></td>
This piece of code really works on another page, but I couldn't get it to do what I wanted to do on this newer page:
<td onclick="rowtoggle(#EventID#);" align="right" <cfif IsOpen is 1>style="color:red">OPEN<br> #calchours# H, #calcminutes# M<cfelse>style="color:grey">CLOSED</cfif></td>
Would this piece do what I need:  
<td onclick="rowtoggle(#EventID#);" align="right" <cfif IsOpen is 1>style="color:green">OPEN<br> #calchours# H, #calcminutes# M<cfif IsReal World is 1>style="color:red">OPEN<br> #calchours# H, #calcminutes# M<cfelse>style="color:grey">CLOSED</cfif></td>

Open in new window

Question by:TIgerV
  • 2
  • 2
LVL 39

Expert Comment

ID: 24865791
How about this..
<td onclick="rowtoggle(#EventID#);" align="right">
 <cfif isOpen>
   <span style="color:green;">OPEN
 <cfelseif isRealWorld>
   <span style="color:green;">OPEN
   <span style="color:grey;">CLOSED
  #calchours# H, #calcminutes# M

Open in new window

LVL 13

Expert Comment

by:Murali Murugesan
ID: 24865846
i would suggest you to use modulo logic for this.

Note: I dont know cold fusion, but the below is a logic i use in JSP to make it simple.




<td class=" IsOpen eq 1?'odd':IsReal eq 1?'even':'even_grey'"></td>



Accepted Solution

xamian earned 500 total points
ID: 24872479
Assuming your testing against a single value, here's an example of how to do what you want to do....(I think):

<!-- Here I'm using  the variable named "TheStatusValue" to hold the incoming information.  This could be coming from a query or another source, it doesn't really matter  -->
<cfset TheStatusValue = "Real World">

<td onclick="rowtoggle(#EventID#);" align="right"
      <cfif TheStatusValue is "Open">
    <cfelseif TheStatusValue is "Real World">
    <cfelseif TheStatusValue is "Closed">
LVL 39

Expert Comment

ID: 24872701

If you're testing only one value, then use cfswitch


Expert Comment

ID: 24873099
I'm guessing there's more to it because the variables in his example seem to be boolean values, so maybe he needs to test the combination of values and change the colors accordingly.  A little more detail would help.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML5 save .Dat to server side 20 50
Select case on click 3 19
html border input line 7 13
Managing DSNs in CF 11 5 17
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

856 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