bobk_IMbranded Posted November 22, 2010 Share Posted November 22, 2010 I have created a FP template that asks for a user to input custom text. I would like to display the text in one field in a specific color - in this case the corporate color of the user's dealership - based on the value of the other field. I've set up a template that has two user input fields: "Dealer" and "Message". "Dealer" is associated with the [log in] info and will pre-populate with a value. Since each DealerName is equal to a specific corporate color, it should return that color to the text in my field "Message". (all my colors are setup in the Advanced/Colors in FusionPro) The rule I created looks like this: if (Field("Dealer") == "DealerName") //from the user's login profile { return <color name = "DodgeRed">Field("Message")</color>; else return <color name = "Black">Field("Message")</color>; } It's not working though. What did I do wrong? Link to comment Share on other sites More sharing options...
Dan Korn Posted November 22, 2010 Share Posted November 22, 2010 I have created a FP template that asks for a user to input custom text. I would like to display the text in one field in a specific color - in this case the corporate color of the user's dealership - based on the value of the other field. I've set up a template that has two user input fields: "Dealer" and "Message". "Dealer" is associated with the [log in] info and will pre-populate with a value. Since each DealerName is equal to a specific corporate color, it should return that color to the text in my field "Message". (all my colors are setup in the Advanced/Colors in FusionPro) The rule I created looks like this: if (Field("Dealer") == "DealerName") //from the user's login profile { return <color name = "DodgeRed">Field("Message")</color>; else return <color name = "Black">Field("Message")</color>; } It's not working though. What did I do wrong? Try this: if (Field("Dealer") == "DealerName") //from the user's login profile return '<color name="DodgeRed">' + TaggedTextFromRaw(Field("Message")) + '</color>'; //else return '<color name="Black">' + TaggedTextFromRaw(Field("Message")) + '</color>';You need either single or double quotes to denote a literal string, and you need to use the plus sign to concatenate strings, including those returned from functions such as Field(). Also, you don't want curly braces around both the primary return statement and the "else" clause. Link to comment Share on other sites More sharing options...
bobk_IMbranded Posted November 24, 2010 Author Share Posted November 24, 2010 Thanks! would that be the same for a box fill? Say, for a background color that was to change color in the same fashion? Link to comment Share on other sites More sharing options...
Dan Korn Posted November 30, 2010 Share Posted November 30, 2010 Thanks! would that be the same for a box fill? Say, for a background color that was to change color in the same fashion? No, to change a frame's fill color, you would do something like this, probably in OnRecordStart: FindTextFrame("YourFrameName").fillColorName = "Red"; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.