These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Ampersand printing

Grika
Registered: Dec 9 2009
Posts: 35
Answered

I am trying to create an email with information from certain fields. One problem I have is that an ampersand is getting "interpreted" instead of passed.

Here is part of my code:

var r = this.getField("Rx");
var cRx = (r.isBoxChecked(0)) ? "Rx" : "";
var l = this.getField("LOMN");
var cLOMN = (l.isBoxChecked(0)) ? "LOMN" : "";
var h = this.getField("H&P");
var cHP = (h.isBoxChecked(0)) ? "H\&P" : "";
var x = this.getField("X-rays");
var cXrays = (x.isBoxChecked(0)) ? "X-rays" : "";

cDocs = cRx + " " + cLOMN + " " + cHP + " " + cXrays;

This successfully updates cDocs with only the checkboxes that are checked but in the resulting email, if the H&P box is checked, all I get are the field values up to just the letter 'H' and the rest of the values are ignored. If I change "H\&P" to something like "HandP" it works fine and I get all the following field values.

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Why the backslash? Ampersands don't need to be escaped.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Grika
Registered: Dec 9 2009
Posts: 35
Heh. Indeed it works just fine without the backslash. Guess I was over-thinking. Thanks.