Solved

Conditional Formatting in Dreamweaver Table

Posted on 2010-08-23
10
705 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

813 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

12 Experts available now in Live!

Get 1:1 Help Now