#1
|
|||
|
|||
![]()
All,
I need help. I have a customer that can add up to 2 phone numbers on a business card. The field tags vary. They need to bold the two phone tag fields and change the color for the divider between the 2 numbers if both are used. I have Treat as Tagged Text selected. I have tried both <b></b> and <f name=""></f> My rule current rule is Code:
if (Field("Phone 1") != "" && Field("Phone 2") != "") return <f name="Gotham Bold">Field("Phone 1 Tag")</f>+' '+Rule("Rule_FormatPhone")+' '+<color name="c0m36y100k8">|</color>+' '+<f name="Gotham Bold">Field("Phone 2 Tag")</f>+' '+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") != "" && Field("Phone 2") == "") return <f name="Gotham Bold">Field("Phone 1 Tag")</f>+' '+Rule("Rule_FormatPhone"); else if (Field("Phone 1") == "" && Field("Phone 2") != "") return <f name="Gotham Bold">Field("Phone 2 Tag")</f>+' '+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") == "" && Field("Phone 2") == "") return ""; The color name for the color I want to use is c0m36y100k8. I see this in both the text frame color drop down as well as colors under advanced. My phone format rules are formatting the numbers as (000) 000-0000. I'm not getting any errors on compose, but it is returning the following: Field("Phone 1 Tag") (404) 213-8360 | Field("Phone 2 Tag") (404) 941-2631 The whole line is black and there is no bold. I appreciate any of the help I can get. Thanks, Traba |
#2
|
|||
|
|||
![]()
All,
I updated my rule to Code:
if (Field("Phone 1") != "" && Field("Phone 2") != "") return '<f name="Gotham Bold">Field("Phone 1 Tag")</f>'+' '+Rule("Rule_FormatPhone")+' '+'<color name="c0m36y100k8">|</color>'+' '+'<f name="Gotham Bold">Field("Phone 2 Tag")</f>'+' '+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") != "" && Field("Phone 2") == "") return '<f name="Gotham Bold">Field("Phone 1 Tag")</f>'+' '+Rule("Rule_FormatPhone"); else if (Field("Phone 1") == "" && Field("Phone 2") != "") return '<f name="Gotham Bold">Field("Phone 2 Tag")</f>'+' '+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") == "" && Field("Phone 2") == "") return ""; It's returning: Field("Phone 1 Tag") (404) 213-8360 |Field("Phone 2 Tag") (404) 941-2631 with bold tags & yellow |. And missing the space between the | and phone 2 tag. Any ideas? |
#3
|
||||
|
||||
![]()
You need to be more careful with your quotes, so that the JavaScript engine knows what parts of your code are literal strings vs. function calls. You should be able to see what's being returned in the Rule Editor when you click Validate, without even composing, to see whether you're on the right track or not. And actually, even without clicking Validate, the syntax coloring in the Rule Editor should give you an idea of what's a literal string and what isn't. (You can click the Editor Settings button to change the Char Color and Strings Color settings to something with more contrast if that helps.)
This should work to keep the Field function calls from being output literally: Code:
if (Field("Phone 1") != "" && Field("Phone 2") != "") return '<f name="Gotham Bold">' + Field("Phone 1 Tag") + '</f>'+' '+Rule("Rule_FormatPhone")+' '+'<color name="c0m36y100k8">|</color>'+' '+'<f name="Gotham Bold">' + Field("Phone 2 Tag") + '</f>'+' '+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") != "" && Field("Phone 2") == "") return '<f name="Gotham Bold">' + Field("Phone 1 Tag") + '</f>'+' '+Rule("Rule_FormatPhone"); else if (Field("Phone 1") == "" && Field("Phone 2") != "") return '<f name="Gotham Bold">' + Field("Phone 2 Tag") + '</f>'+' '+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") == "" && Field("Phone 2") == "") return ""; Code:
if (Field("Phone 1") != "" && Field("Phone 2") != "") return '<f name="Gotham Bold">' + Field("Phone 1 Tag") + '</f><space>'+Rule("Rule_FormatPhone")+' '+'<color name="c0m36y100k8">|</color><space>'+'<f name="Gotham Bold">' + Field("Phone 2 Tag") + '</f><space>'+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") != "" && Field("Phone 2") == "") return '<f name="Gotham Bold">' + Field("Phone 1 Tag") + '</f><space>'+Rule("Rule_FormatPhone"); else if (Field("Phone 1") == "" && Field("Phone 2") != "") return '<f name="Gotham Bold">' + Field("Phone 2 Tag") + '</f><space>'+Rule("Rule_FormatPhone2"); else if (Field("Phone 1") == "" && Field("Phone 2") == "") return ""; Code:
var items = []; if (Field("Phone 1")) items.push('<f name="Gotham Bold">' + Field("Phone 1 Tag") + '</f><space>' + Rule("Rule_FormatPhone")); if (Field("Phone 2")) items.push('<f name="Gotham Bold">' + Field("Phone 2 Tag") + '</f><space>' + Rule("Rule_FormatPhone2")); return items.join(' <color name="c0m36y100k8">|</color><space>');
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() |
![]() |
Tags |
bold, color, color text, font |
Thread Tools | Search this Thread |
Display Modes | |
|
|