Hi,
I don’t know how to achieve the following effect. I’m showing with a form in the “List view”. On that form there is an icon that should be shown if a field [on that form] is 0 and hidden if the field is 1.
At first I tried to do set “elements.readButton.visible=false;” but then the icon is gone in all records. I’ve tried to play with calculation but I couldn’t figure out how to do it. Right now I’m in a point where the icon is always visible or always invisible.
Could you help me?
Hi James,
You need to use a calculation
if ( myField == someValue )
{
return "media:///icon1.gif";
} else {
return "media:///icon2.gif";
}
Make sure the calc is of type MEDIA and check if you use the correct media names (including extension).
Hope this helps.
I’m trying but it doesn’t seem to work.
I’ve put the calculation in the dataProvider property of the label/Button. That is what I am supposed to do , right?
if (read===0) {
return "media:///cancel.png";
}
else {
return "media:///empty.png";
}
You need to place a field on the form that has the calculation as the dataprovider. Make sure that the DisplayType of this field is set to IMAGE_MEDIA.
Like Paul said you need to use a field with display type set to IMAGE_MEDIA.
If you want to use a label or a button then you need to change the calculation to the following code:
if (read==0) {
return "<html><img src=media:///cancel.png></html>";
}
else {
return "<html><img src=media:///empty.png></html>";
}
Of course the calc type should be TEXT.
Hope this helps.
Thanks for your help.
I ended up doing:
if (read==0) {
return "<html><img src=media:///cancel.png></html>";
}
else {
return "<html></html>";
}
The action on the label is not totally removed but that’s ok.