PDA

View Full Version : Color Change Code


ksulliv1
January 20th, 2010, 02:21 PM
Ok in this instance I have created a rule that adds the correct initial in front of the text entered into a form field for a phone number, depending on what is selected in a dropdown list for that phone number. So if they choose "Office" the rule will put a lower case o. in front of it in a different font that the field itself. The rule is called "PhoneLabel1Rule" and is good to go. However we are going to offer these cards in three different color versions, so the initial created by the rule also has to change colors depending on what the user selects in another dropdown list. So I am trying to create a second rule that is applied to the first rule that simply changes the color of the result of the first rule.

So I tried to say if the color selected for the card is blue then make the phone intials created by PhoneLabel1Rule be Pantone 2905 C. The string is below and it says if the value in the text field "Color" begins with "B" the return "change color to PANTONE 2905" plus the "PhoneLabel1Rule" but it is not changing the color of the intial yet. So please help me to make the changes necessary to the code.


if (Left(Field("Color"),Len(String("B"))) == String("B"))
{
return "<span>" + "<color name=PANTONE 2905 C>" + Rule("PhoneLabel1Rule") + String("") + "</span>";
}
return "";


Thanks

ksulliv1
January 21st, 2010, 08:19 AM
Hi everyone, I have figured out a way to resolve this issue using the Variable Text Editor (VTE) window that was really simple once I figured it out. All I had to do, once I had the "PhoneLabel1Rule" working as it should and placed in the proper location in the VTE, and the "ChangeColorRule" created, was to just drop the "ChangeColorRule" on top of the "PhoneLabel1Rule" in the VTE. So I still have no idea how to write the JS code for this or even what it would look like, but it is working the way I need it to.

I was unaware that you could apply one rule to another by simply placing one on top of the other in the VTE before now. It's a very helpfull feature within the program for us noobs and I hope this helps someone else when they read it.