yourguide
Posts: 44
|
| Posted: 06/25/2012, 12:40 PM |
|
Very new user to Codecharge... just wanted to ask the best way to go about using code to change the color of a label when the data is a "Y" and leaving alone when its a "N".
I have a bunch of Y/N values I need to display.
The idea is instead of a whole bunch of checkboxes... I want to change the label to RED when the value is "Y" so as to highlight those.
I know how I would accomplish this with straight PHP code... but I wanted to know if there is a "CodeCharge" way of doing this kind of thing?
Example: (Not valid code.. just to get the point across)
Spec A - <RED>Spec B</RED> - Spec C
<RED>Spec D</RED> - Spec E - Spec F
Thanks.
_________________
Independent, self-employed, web developer. |
 |
 |
saseow
Posts: 744
|
| Posted: 06/25/2012, 9:29 PM |
|
Try something like this:
In the label properties make sure it is HTML then...
In the "Before Show" event"
if ($Component->GetValue() == 1)
{
$Component->SetValue("Y");
$Component->SetValue("<font color=RED>".$Component->GetValue()."</font>");
}
else
{
$Component->SetValue("N");
}
|
 |
 |
yourguide
Posts: 44
|
| Posted: 06/27/2012, 11:04 AM |
|
Thank you. That's got me going on the right track!
_________________
Independent, self-employed, web developer. |
 |
 |
yourguide
Posts: 44
|
| Posted: 06/27/2012, 11:05 AM |
|
Now if only I would stop trying to learn Codecharge on my live project... perhaps I wouldn't be so upset when it blows up. 
_________________
Independent, self-employed, web developer. |
 |
 |
|