This topic is locked

Changing color of a field based upon value

8/6/2008 2:00:06 PM
PHPRunner General questions
Z
zc2ndbass author

I know i have seen this post some where but i can't find it
How do you change the color of a field based upon the value?

Say if i have a total of 100% it will turn green or if i have a total of 40% it will turn red
Thanks

J
Jane 8/7/2008

Hi,
Set View as type of this field to Custom and use the following code:

$str = "<table width=100% bgcolor=";

if ($value=="100%")

$str.= "green";

else

$str.= "red";
$str.= "><tr><td>".$value."</td></tr></table>";

$value = $str;