#1
|
|||
|
|||
![]()
Hi,
I have a problem with a piece of code on a business card in DSF/FP9.3. We need to keep a string on one line without wrapping and use the function below. Works fine unless there is a "&" in the input field. "Me And You" works fine but "Me & You" composes to "Me & You" Anyone know how to overcome? Code:
function NoBreak(s) { return NormalizeEntities(s).replace(/ /g, " "); } return NoBreak(Field("title")); |
#2
|
||||
|
||||
![]()
Try this:
Code:
function NoBreak(s) { return s.replace(/ /g, " ").replace(/ /g, " "); } return NoBreak(TaggedDataField("title"));
__________________
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)}); ![]() |
#3
|
|||
|
|||
![]()
It seems like maybe you have not checked the box "Treat returned strings as tagged text" in the rule editor window.
__________________
FusionPro VDP 9.3.12 Desktop/Server Windows 7 Enterprise / Windows Server 2008 r2 Acrobat X |
#4
|
|||
|
|||
![]()
Thanks for your replies.. @Dan, your suggestion has exactly the same result - the "&" input composes to &
Code:
function NoBreak(s) { return s.replace(/ /g, " ").replace(/ /g, " "); } return NoBreak(TaggedDataField("title")); @tobarstep - I have checked the "Treat returned strings as tagged text" checkbox. If not checked, all no break spaces would show as when composing. I suspect this has to do with how DSF is handing over the text input to FP Server. Would it maybe be possible to convert the entity "&" to a plain text "&" in the script before trying to perform the NoBreak function? |
#5
|
||||
|
||||
![]()
I wonder if the conversion is happening elsewhere in your DSF – prior to the data being processed by the TaggedDataField function. If that were the case, the first ampersand in "&" would be converted to the same entity and give the appearance that it wasn't being properly converted to raw text. With that in mind, you could try to account for that:
Code:
function NoBreak(s) { return s.replace(/&/g,'&').replace(/ /g, " "); } return NoBreak(TaggedDataField("title")); Code:
function NoBreak(s) { return RawTextFromTagged(s).replace(/&/g,'&').replace(/ /g, " "); } return NoBreak(TaggedDataField("title"));
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#6
|
||||
|
||||
![]() Quote:
That's basically what the TaggedDataField function does. It accounts for the fact that the data file generated by DSF (like with MarcomCentral and other web-to-print apps) is tagged markup, while the data used for local FP Desktop/Creator compositions is almost always flat-file, non-tagged data.
__________________
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)}); ![]() |
#7
|
|||
|
|||
![]()
@step, the code below did the trick - ampersands shows correctly in DSF!
![]() Code:
function NoBreak(s) { return s.replace(/&/g,'&').replace(/ /g, " "); } return NoBreak(TaggedDataField("title")); Thanks for all your support - I hope to be able to re-contribute at some point! |
#8
|
|||
|
|||
![]()
Ste, you are the best.
Revisiting my ampersand issues a year later, now that we are moving our clients from Avanti eAccess to EFI DSF. The same solution that worked for Thomas also solved my issues perfectly (as one would expect, since it looks like we're both working in DSF). Thank you!
__________________
Michelle Digital Services Coordinator at Rileys (print and electronic services provider) in Alberta, Canada FusionPro VDP 9.1.0, Windows 7, Acrobat Pro XI , InDesign CS6, Avanti eAccess, EFI Digital Storefront |
![]() |
Tags |
&, ampersand, dsf, javascript |
Thread Tools | Search this Thread |
Display Modes | |
|
|