Copy link to clipboard
Copied
In creating a form to calculate Quantity x Price = Result. I am experiencing issues with the Calculate section of the text properties field.
In the Price Text Field I set a Default value in the Options tab
In the Result Text Field I use the Calculate tab. I am permitted to select the appropriate fields that will be used for the calculation using pick... but upon clicking OK the "value is the product" area remains blank.
Is this a known issue?
Steps I have tried.
Restart Acrobat
Restart Machine.
Initial result was successful and I was able to create a calculation field...ONCE
Then the problem returned along with the default value showing as 1 instead of any other number.
I created a new InDesign document and again was able to get a calculating filed ONCE.
The form I would like to build will have several lines of this nature. I need to be able to rely on it if I have to make a design change and don't want to suddenly encounter the issue.
UPDATE:
I believe I have narrowed down the problem. As of now I am able to have those fields set with a default value behave correctly but the only consistent method of attaining a calculation field is to delete the one generated by InDesign and crate a new one directly within Acrobat. The calculation is accepted from the pick options.
The box created in InDesign is set as Type: Text Field and Printable.
Currently the best case scenario is to recreate all the calculated boxes in Acrobat. I was rather hoping the InDesign to forms solution would alleviate that. I will have over 60 products.
Mac OS Sierra
iMac 5k
Acrobat Pro DC 2018.011.20040
InDesign CC 13.1
Copy link to clipboard
Copied
The most reliable method is to create the fields in Acrobat, due to various bugs related to PDF forms generated by InDesign. There are a number of methods to speed up the process considerably. I'd also recommend using the simplified field notation option, though I would personally use JavaScript. By adhering to a specific field naming convention, the script that each calculated field calls can be a single function in a document-level JavaScript, greatly simplifying the scripting part. I realize this isn't too helpful at this point, but if you want more information about any of these suggestions, post again.
Also, you need to learn how to set the field calculation order and why it's important, if you don't know already.
Copy link to clipboard
Copied
The most reliable method is to create the fields in Acrobat, due to various bugs related to PDF forms generated by InDesign. There are a number of methods to speed up the process considerably. I'd also recommend using the simplified field notation option, though I would personally use JavaScript. By adhering to a specific field naming convention, the script that each calculated field calls can be a single function in a document-level JavaScript, greatly simplifying the scripting part. I realize this isn't too helpful at this point, but if you want more information about any of these suggestions, post again.
Also, you need to learn how to set the field calculation order and why it's important, if you don't know already.
Copy link to clipboard
Copied
Thankyou George for you reply.
For the second page - after spending an entire day with page one - I did use Acrobat as the means of creating the text fields. Aside from one hiccup it went well, though I believe the program could use some tweaking with regard to performance.
The hiccup seemed to be related to a field that would show in the pick list but not actually in the Fields list. So I couldn't delete it. For that issue I cut all the fields and then pasted them back. It worked.
I use the Pick option as I am not familiar with Javascript and the two things that are tedious about that are the long list of fields to scroll through and the fact that the box always opens in the bottom left of the screen. Whats up with that?
The long list wasn't so bad as I took care to name the fields consistently. A 3 column array of qty / tot / price. with successive numbers. So entering the formula was quite easy (by that I mean selecting the correct fields from the long list)
Bonus: I discovered that I did not have to close the Properties box after each entry but merely needed to select the next text field down. A Time saver there. And I already knew about the duplication of fields with Create Multiple Copies - I assume that is the correct method. It helped with the subtotal.
Building forms is not a task I require often so Javascript is not an area I gravitate to first. I searched for some potential answers but lack the understanding of the solution as " price.0*qty.0 " is apparently not a correct format. It couldn't be that simple.
Here is the form I am referring to should you care to glance. If there are glaring errors, perhaps let me know. I realize that it probably could be leaner with some javascript but learning to say "my name is..." in a foreign language is not the same as understanding how to say "the name of this random person is..."
I looked into field calculation order but in my case I determined that it was either, a: unnecessary to be that precise or b: my document just isn't that complicated.
Thankyou again for your time.
Copy link to clipboard
Copied
When punctuation, spaces, etc. (non-alphanumerics) are used in the a field name, you have to escape each such character with a backslash character when using the simplified field notation option, so in your example you'd have to specify:
price\.0 * qty\.0
I understand about the other stuff. I might have time to take a look at the form later tonight...
Good luck.
Copy link to clipboard
Copied
If you look at the field calculation order fields tot.0 and tot.1 are calculated after all the other fields of the form and not as the first two fields to be calculated. This will result in the "sub total" not being updated if either of these two fields are updated. So when I enter a quantity in the first item, the "sub total" is no updated and when I change the quantity for second item the sub total only show the total for the first item. It is only after a quantity for another item that the sub total shows the correct sum.
With learning JavaScript, one can create the calculation script to programaticaly determine the column number from the field name being calculated and then compute the "total" using the computed field names.
JavaScript is not only used for forms but is important for Actions or Batch Processing and can be used for redaction as well as other action within a PDF.
In programming one should never "assume" anything.
Copy link to clipboard
Copied
Thankyou guys. I attended to the calculation order once I understood it better - and added two more pages!
George_Johnson​ that java script nugget worked and was marginally faster to implement over many fields. Im not sure how it differs from the auto generated javascript created by the Pick option with respect to functionality.
I am becoming more comfortable with the setup of the form now and realizing that Acrobat does not like to play with copy and paste of fields when updating content. Its as if it remembers the previous field but doesn't show them on the form - only in the Pick list.
Currently, if you're still watching, I have an issue with a submit button on mobile devices -iPhone. That is to say it does nothing.
The behavior is set to "Mouse Up / FDF / One email address" It works on desktop and I even saved as Reader Extended.