This topic is locked
[SOLVED]

 How would I make a graphic show up as a result of a fiel

12/15/2010 2:09:53 PM
PHPRunner General questions
K
karmacomposer author

Hello everyone.
My database project is coming along nicely. I have a question:
I have a field called IsApproved. This field is an integer and can either be a 0 or a 1.
If 0, they are NOT approved. I would like to have a place in the list where a RED graphic box shows up if IsApproved = 0.

If 1, they are APPROVED. I would like to have a GREEN graphic show up if IsApproved = 1
How would I do this?
Mike

kujox 12/16/2010



I have a field called IsApproved. This field is an integer and can either be a 0 or a 1.

If 0, they are NOT approved. I would like to have a place in the list where a RED graphic box shows up if IsApproved = 0.

If 1, they are APPROVED. I would like to have a GREEN graphic show up if IsApproved = 1


In the visual editor you need to choose custom and use the code.



If ($value == 1) {

$value = '<img src="/green.jpg">';

} else {

$value = '<img src="/red.jpg">';

}
K
karmacomposer author 12/16/2010



In the visual editor you need to choose custom and use the code.



If ($value == 1) {

$value = '<img src="/green.jpg">';

} else {

$value = '<img src="/red.jpg">';

}



So, if the variable in question is: isHeld, would the following be correct?
If ($value(isHeld) == 1) {

$value = '<img src="/red_but_3d_sm.png">';

} else {

$value = '<img src="/green_but_3d_sm.png">';

}
or do I just leave it as is:
If ($value == 1) {

$value = '<img src="/red_but_3d_sm.png">';

} else {

$value = '<img src="/green_but_3d_sm.png">';

}
Where do I add it in the visual editor? The field is an integer value (isHeld), so do I place this code snippet next to the field value? If I double click on the field value, it does not give me the option to add a code fragment like in other fields (text fields, var char, etc).
Thanks for your help.
Mike

Sergey Kornilov admin 12/16/2010

In the visual editor you need to choose custom and use the code...

K
karmacomposer author 12/16/2010





Got it.
It worked, but only the green graphic shows up.
I need the red graphic to show up when a candidate is on hold (isHeld) and green when not on hold.
What do I need to change to make this work 100%
Here is the current code:
If ($data["isHeld"] == 1) {

$value = '<img src="/database/red_but_3d_sm.png">';

} elseif ($data["isHeld"] == 0 or $data["isHeld"] == "" or $data["isHeld"] == '') {

$value = '<img src="/database/green_but_3d_sm.png">';

}
Mike

Sergey Kornilov admin 12/16/2010

You need to make sure that value of isHeld field is actually 1. If you are always seeing green icon that means value of this field is always 0 or empty.

K
karmacomposer author 12/16/2010



You need to make sure that value of isHeld field is actually 1. If you are always seeing green icon that means value of this field is always 0 or empty.


I'm really stuck here because I cannot seem to make changes to the fields in PHPRunner. Every time I do and then go to the Visual Editor, it reverts back. I cannot send to the demo account because it says the file is too large (over 25MB).
I do understand what you are saying, though. I need to make sure there is a '0' in place until someone is actually on hold, and then a '1' is put there for 72 hours, at which time a '0' needs to go back to that field.
Mike