Solved

Conditional Formatting in Dreamweaver Table

Posted on 2010-08-23
10
710 Views
Last Modified: 2013-12-13
I am using Dreamweaver to create a "Dynamic" information table.  It is setup as a repeat region and pulls data from a MySQL database.  One of the cells of data contains the values "Hot" or “Medium" or “Cool"  The user decides when they enter the data.  This is held in a dropdown menu.  I would like to highlight the row that has "Hot" red. My table of data is as follows

First Name    Last Name    Etc    Etc   Hot
So this row needs to be highlighted red.

I can do this in Access but how can I do it in Dreamweaver or CSS or something else?
Thanks
0
Comment
Question by:napsternova
[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
  • 5
10 Comments
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33501338
Do you want it to highlight red when it pulls an existing row from the database, when you user selects it as a new entry, or both?
0
 

Author Comment

by:napsternova
ID: 33501419
Hmmm, both would be impressive but ultimately the row in the "report" table.  I have a couple CSS scripts already attatched.
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33501456
Can you post the code that repeats the result row?
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:napsternova
ID: 33502515
<?php do { ?>
              <tr class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>">
                <td><input type="checkbox" name="kt_pk_Leads" class="id_checkbox" value="<?php echo $row_Recordset1['LeadID']; ?>" />
                  <input type="hidden" name="LeadID" class="id_field" value="<?php echo $row_Recordset1['LeadID']; ?>" /></td>
                <td><div class="KT_col_LeadFirstName"><?php echo KT_FormatForList($row_Recordset1['LeadFirstName'], 20); ?></div></td>
                <td><div class="KT_col_LeadLastName"><?php echo KT_FormatForList($row_Recordset1['LeadLastName'], 20); ?></div></td>
                <td><div class="KT_col_ContactLevel"><?php echo KT_FormatForList($row_Recordset1['ContactLevel'], 20); ?></div></td>
              </tr>
              <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
0
 

Author Comment

by:napsternova
ID: 33504588
Should I post something else?  
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33504626
Sorry, had that nagging "day job" to tend to... :)

what does <?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?> look like in your CSS?
0
 

Author Comment

by:napsternova
ID: 33505433
Pretty sure that represents alernating row colors, white for the odd and gray for the even.  The hightlight (rollover) color is green.  Day job?  Yeah they tend to get in the way.  :)
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33507978
How familiar with PHP are you? It would appear from the code that you are probably just using the drag/drop functionality of Dreamweaver.

I ask, because I would suggest putting some PHP conditionality into the TR that points to conditional CSS, and didn't know how detailed to be...
0
 

Author Comment

by:napsternova
ID: 33510945
wmcdon7160,
PHP I can handle but CSS not so much.  I have been using the original version of the Adobe toolbox because it works really well.  It does seem to add a lot of extra code but it generates forms and tables that are really clean looking.  I use the Conditional functionality in MS Access all the time but never on the web.  This would be a great tool I can use for many things, like checking dates and sending reminders, highlighting fields when a certain date comes around, highlight table rows to bring attention, etc.  I would like to understand how to do this.  If I should read up on CSS I can do that too, and sounds like I probably should.
Thanks,
Jeff
0
 
LVL 3

Accepted Solution

by:
wmcdon7160 earned 250 total points
ID: 33511613
Make a new CSS class called "hot", or whatever.
It will look a lot like the KT_EVEN class.

Then add an IF statement (or DO WHILE) in the <tr> code.
I would try something like the following:
[it's separated on different lines for clarity]


<tr class="
<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>
<?PHP IF ($row_Recordset1['ContactLevel'] == "hot") 
  {echo " hot";} ?>
">

Open in new window

0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Link failure 16 70
if(empty) validation fires when trying to select 0 from select list 21 60
Length of for loop to be dynamic 2 33
Compiling PHP with Curl plus protocols 8 25
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 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