Copy link to clipboard
Copied
I'm sure there is a very simple explanation for this. Our business uses a Bill of Sale in pdf format for all of our dealings, recently its come to my attention there is a single line that is off in the calculation, and all I need to do is add one more field to the total cost calulation, but anytime I make ANY change to the file and save it, it no longer populates the Total amount of sale. I was making a simple javascript addition to the text box, to make sure it adds the sum of 6 different text box's to my total cost. But as soon as I add the +text field130 to the existing script then save, my last text field "total cost" no longer populates.
I even tried just changing a random letter in the file and then changing it back to what it was, just so i could save the file. Once I did that, it still no longer populated.
Help?
1 Correct answer
For the spaces in the field names you must use \ .
E.g. Text\ Field123
Copy link to clipboard
Copied
What script does you use?
Copy link to clipboard
Copied
"Simplified field notation" it's an option on the "calculate" tab under text field properties. It's just simple Javascript.
Copy link to clipboard
Copied
Text Field123+Text Field124+Text Field125+Text Field126+Text Field127-Text Field128 ------Is the script thats already there and working fine. But as soon as I add +Text Field130 to the script, it no longer populates my total cost.
Copy link to clipboard
Copied
For the spaces in the field names you must use \ .
E.g. Text\ Field123
Copy link to clipboard
Copied
Can you explain the reasoning for me? The pre-existing working script that I pasted here works just fine without the \ but I added it in anyway and now even my new addition works all of a sudden. It makes no sense to me. Is it an old way of writing vs a new way of writing or something?
Copy link to clipboard
Copied
You must use \ for all special characters in field names, like space, +, -, and so on.
Copy link to clipboard
Copied
The Simplified Field Notation entry has to be parsed. This means all the bits of text have to be broken up and recognized as field names and operators. Several punctuation characters have special meaning, the space is a seperator, "+" means add, etc. So if there is a punctuation character in a field name, then the parse engine has to be told to ignore it so it can determine what is and is not a field name, hence the escape character. A good rule of thumb is to never use punctuation in a field name.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thom_Parker that explanation makes perfect sense to me, what doesnt make sense is why the pre-existing script worked WITHOUT the \ inserted, and it wasnt until I tried to change the file in ANY way, that it no longer worked. I can only conclude that when the file was originally created, the \ wasn't required to identify the space, and in the newer versions of Adobe it was required to show variables.
Copy link to clipboard
Copied
Nope, it's always been that way. Because you know, parseing the input was always required, and it always has the same issues. There is something else going on.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Ah okay, well I appreciate the response, the main thing is it's now working. Thanks very much everyone.

