This topic is locked
[SOLVED]

 Change Cell on Value

9/1/2019 12:37:23 PM
PHPRunner General questions
S
swanside author

I have searched and tried several, but either the whole list of cell goes the same colour or it does nothing

I have this

if ($data["Priority"]=="HIGH")

$record["Priority_css"]='background:red';
if ($data["Priority"]=="MEDIUM")

$record["Priority_css"]='background:yellow';
if ($data["Priority"]=="LOW")

$record["Priority_css"]='background:green';


Where an I going wrong please? in the List page:After record processed?

Cheers

D
david22585 9/1/2019



I have searched and tried several, but either the whole list of cell goes the same colour or it does nothing

I have this

if ($data["Priority"]=="HIGH")

$record["Priority_css"]='background:red';
if ($data["Priority"]=="MEDIUM")

$record["Priority_css"]='background:yellow';
if ($data["Priority"]=="LOW")

$record["Priority_css"]='background:green';


Where an I going wrong please? in the List page:After record processed?

Cheers


I use the same thing and it works fine for just a cell for me.

woodey2002 9/1/2019

I format the cell as custom view on lit page.
There is a good tutorial I believe somewhere on xlinesoft showing this
https://xlinesoft.com/phprunner/docs/conditional_formatting.htm
This code works for me



if ($value == "Open") {

$value=' <img src="images/red2.png" alt="" />'." ".$value;

$color="red";

} else {

$value=' <img src="images/green2.png" alt="" />'." ".$value;

$color="green";

}

$value="<span style='color: " . $color . "'>" . $value . "</span>";
S
swanside author 9/2/2019



I use the same thing and it works fine for just a cell for me.


Cheers, but for some reason I just cant get it to change that cell colour!!!

jadachDevClub member 9/2/2019

Something else is up. Your code should work

S
swanside author 9/3/2019

Yep. I just don't get it.

I have even tried it on the demo account and it just don't work for me!!

Tought it was pretty simple....

If the field called Priority has a value of HIGH the cell would go red <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=88680&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> Back to google!!!!

M
Mark Kramer 9/3/2019

Works here too. Try it in the "View As/Edit As " then view as custom and put the code there.
I use a check box. not checked = "0" not prioity . Checked = "1" High priorty
and here is my code:
if ($value == 1) {

$color="Red";
$value="<span style='color: " . $color . "'><BGCOLOR=RED>

High!

</span>";

} else {

$value= " ";
}
It could easily be adapted to 3 radio buttons High, Med, Low...
It's that stupid little crap that drives one crazy... You are so @#^$# close .... Time to step away for a moment re-think it..

lefty 9/3/2019

// List Page after record processed event page - case sensitive!
$record

}
$record

}
$record

}
else {

// something else or nothing white

}
[color="#666600"]//All set!! for PHP - have to use else if in php see Here

S
swanside author 9/4/2019



// List Page after record processed event page - case sensitive!
$record

}
$record

}
$record

}
else {

// something else or nothing white

}
[color="#666600"]//All set!! for PHP - have to use else if in php see Here


Oh Right, cheers That worked for 66% of the code <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=88693&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> the one for HIGH will not change colour, I have mixed them around into a different order and just trying out now on the demo account to see how it goes.

Thanks for the help

Paul.
UPDATED.............

I could blummin kick myself...... I have just looked in the PHPMyAdmin at the data, thinking there has to be something there, and I discovered that there are whitespaces after the actual word HIGH

Once edited it now shows the colour Tomato as Red was a bit heavy on the text. Thanks for all the help and support guys. Much appreciated..
Paul.