Jump to content

Changing B/G image and Text Color based on a Field Value


Recommended Posts

Here's the scenario:

My product is a window sticker for a car dealership. The sticker has either a color background (by default) or a white background that can be chosen from a drop down. *The color background is one of 25 possible and is predetermined by the login dealership name. The rules looks to the value of the field "Dealer" and depending on what is filled in will return the proper colored background. no problem there.


I will allow the buyer to enter his own text. The text by default is white and will remain white unless the drop down choice for the background color is white, where upon the text will have to appear in color - and just like the color of the background, the text color will change to a predetermined color based on the value of the field "Dealer"


so with that set up...


Here are rule codes -

Graphic Rule to return a colored or white background:


if (Field("Dealer").toLowerCase().indexOf("acura north scottsdale") > -1)

return Resource("colored_background.png");


else if (Field("DropChoice") == "White Background ")

return Resource("white_background.png");



Text Rule to return colored text or white text:

if (Field("DropChoice") == "White Background ")

case (Field("Dealer").toLowerCase().indexOf(String("acura")) > -1)

return '<color name="acuraBlue">' + TaggedTextFromRaw(Field("Message")) + '</color>';


case (Field("Dealer").toLowerCase().indexOf(String("dodge")) > -1)

return '<color name="dodgeRed">' + TaggedTextFromRaw(Field("Message")) + '</color>';


Will this work?


Also here's a problem I foresee. What to I do if I choose white from the drop down (assuming it works) but then want to go back to the default? Should I have a second background drop down choice that says 'color background' and the create a rule for it with case by case scenarios to read the value Dealer again (similar to what I did for the text)?



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...