spotless7325 Posted January 23, 2012 Share Posted January 23, 2012 Hi. I have a problem with a businesscard. On one line I have two variable fields, "Direct" and "Mobile". The first problem I had was that the hole line disappeared when one of the fields was not filled in. That problem was sovled with this rule: var EntriesWithLabels = [ "Direct", Field("Direct"), "Mobile", Field("Mobile"), ]; var resultArray = new Array; for (var i = 0; i < EntriesWithLabels.length; i += 2) if (EntriesWithLabels && EntriesWithLabels[i+1]) resultArray.push(EntriesWithLabels + ": " + EntriesWithLabels[i+1]); return resultArray.join(" "); The second problem I have is that I want the static text ("Direct" and "Mobile") to be in one font and the variable text in another font. I did not write this rule myself. I'm a JavaScript n00b, so any help wold be much appreciated. Link to comment Share on other sites More sharing options...
Dan Korn Posted January 23, 2012 Share Posted January 23, 2012 Replace that next-to-last line with this: resultArray.push('<f name="Arial">' + TaggedTextFromRaw(EntriesWithLabels[i]) + ": " + '<f name="Times">' +TaggedTextFromRaw(EntriesWithLabels[i+1]));Enter whatever font names you want. Make sure to check the "Treat returned strings as tagged box" box. Link to comment Share on other sites More sharing options...
spotless7325 Posted January 24, 2012 Author Share Posted January 24, 2012 Hi again Dan. Thanks for your fast answer. However I replaced the line you said so the rule look like this: var EntriesWithLabels = [ "Direct", Field("Direct"), "Mobile", Field("Mobile"), ]; var resultArray = new Array; for (var i = 0; i < EntriesWithLabels.length; i += 2) if (EntriesWithLabels && EntriesWithLabels[i+1]) resultArray.push('<f name="FuturaEFOP-Medium">' + TaggedTextFromRaw(EntriesWithLabels) + ": " + '<f name="FuturaEFOP-Book">' +TaggedTextFromRaw(EntriesWithLabels[i+1])); return resultArray.join(" "); When I validate this rule I get a Error saying: Line 9:ReferenceError: TaggedTextFromRaw is not defined. line 9 is the resultArray.push line... What have I done wrong? Kind regards Jonas. Link to comment Share on other sites More sharing options...
Dan Korn Posted January 24, 2012 Share Posted January 24, 2012 When I validate this rule I get a Error saying: Line 9:ReferenceError: TaggedTextFromRaw is not defined. It's impossible for me to know what version of FusionPro you're using, since you don't specify it in your profile or your signature. If it's an older version (prior to 6.0), you need to use NormalizeEntities instead. Link to comment Share on other sites More sharing options...
spotless7325 Posted January 24, 2012 Author Share Posted January 24, 2012 Thank you so much, you made my day. The rule works like a charm now. I have changed my details in my profile now. Once again thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.