Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is this possible

Guest
Jun 16, 2009 Jun 16, 2009

Is it possible to accomplish something like this with CF and CSS. Lets say i have the following status types(open,closed,canceled) and i have a table like this:

<cfquery name="job" datasource="#request.dsn#">

     SELECT *

     FROM tbl_jobs

</cfquery>

<table>
    <tr>
        <td>Date</td>
        <td>Status</td>
    </tr>
    <cfoutput>
    <cfloop query="jobs">
        <tr>
            <td>#job.date#</td>
            <td>#job.status#</td>
        </tr>
    </cfloop>
    </cfoutput>
</table>

Would it be possible to have the status <td> background change color depending on the status? So lets say when the status is "open" it will change <td> background to blue, and if the status is "closed" it will change it to red.

Or is there some way to accomplish this?

425
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jun 16, 2009 Jun 16, 2009

Yes easily.

Just one of a hundred possible ways:

<style>

     td.open {background-color: blue;}

     td.closed {background-color: red;}

    td.cancled {background-color: green;}

</style>

...

<tr>
  <td>#job.date#</td>
  <td class="#job.status#">#job.status#</td>
</tr>

Translate
Valorous Hero ,
Jun 16, 2009 Jun 16, 2009

Yes easily.

Just one of a hundred possible ways:

<style>

     td.open {background-color: blue;}

     td.closed {background-color: red;}

    td.cancled {background-color: green;}

</style>

...

<tr>
  <td>#job.date#</td>
  <td class="#job.status#">#job.status#</td>
</tr>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 18, 2009 Jun 18, 2009
LATEST

Thank you, that was exactly what i was looking for.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources