Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Tons of format errors in a fillable PDF form, when you go to fill the form

Community Beginner ,
Jan 17, 2019 Jan 17, 2019

Hoping the community can help me. I know enough to be dangerous but javascript, etc, are outside my typical functions.

I created a form for some manual testing we perform in our laboratory. [The current form is in xls and the operators consistently and inadvertently delete equations, etc.] This form took me half a day to "get working" as it was my first form with fields that relied on other fields. The calculations are relatively straightforward and I was very careful to check and double-check my simple scripting for the calculations needed.

Everything looked pretty good and my preview went fine. So I saved the form, closed it, and then opened it to fill it out. Fields unrelated to any calculation field in the document fire pretty much as soon as I fill in the first field, date. I get 4 or 5 pop-up error boxes stating that the format of the field does not match that of the fields doing calculations....these fields have NOTHING to do with any calculation in the form!!! As it stands, though the calculations do work, it takes too long to frustratingly clear all those error boxes, every single time a field is completed. So my techs will not use this - they will hate it, because I'm already foaming at the mouth with anger - but I don't want to lose all this work and the promise of a functional form that even looks good for printing and showing to inspectors, providers, etc, if questions ever arise.

I know someone in this community can help me. Please feel free to reach out with some kind of tip. But if it's all javascript-y, I'll probably have immense trouble understanding it. Please forgive the very-steep learning curve that I'm trying to climb. I tried to attach the form to the thread but there was no option, and a drag and drop failed. Happy to send it via email for someone to check/review.

Thank you!!

Danyel

TOPICS
PDF forms
3.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jan 17, 2019 Jan 17, 2019

These error messages typically happen when you have a Number field with a calculation where the divisor is the value of another field. When the latter is empty (or zero) you're in effect doing division by zero, which is not allowed and then you get this error message. It will appear each time you edit any field in the file, whether or not that field has anything to do with the calculated field that's causing this issue.

The solution is to use a script to perform the calculation and add an if-condition in it where if the divisor is zero, apply an empty string to the field.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2019 Jan 17, 2019

What format does you use in the fields?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2019 Jan 17, 2019

Hi Bernd!

I used:

  • date for the date field (m/d/yy)
  • no formatting for the text/mixed fields like names, chart numbers
  • number, no decimals for the input fields
  • number, no decimals for the fields doing the calculations (we need whole number results)

I couldn't really see a way to "create a section" like I can do in a "Word-type" document.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2019 Jan 17, 2019

For the calculated number fields you get an error message when you divide by zero.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2019 Jan 17, 2019

The built-in format functions like to complain whenever data in the field does not match the expected format.  This does not usually include blank fields.

This problem typically happens because a calculation places a value into formatted field. A good rule of thumb is to never use the built-in formatting with a calculated value. Because the built-in formatting is intended to assist manual input. When a value is automatically calculated it is entirely under the control of the calculation script. Extra formatting scripts just get in the way. Especially when the calculation has a problem.

So the first part of fixing your issue is to get rid of all the format script on all the calculated fields.

The second part to fixing this issue is to start small. If the problem persists, create a  copy of your form and delete all but one of the fields that is causing an issue, then see if you can figure out just the one issue.  It is a good practice to always test out something new with the minimum setup, so you can learn how to do it right.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2019 Jan 17, 2019

These error messages typically happen when you have a Number field with a calculation where the divisor is the value of another field. When the latter is empty (or zero) you're in effect doing division by zero, which is not allowed and then you get this error message. It will appear each time you edit any field in the file, whether or not that field has anything to do with the calculated field that's causing this issue.

The solution is to use a script to perform the calculation and add an if-condition in it where if the divisor is zero, apply an empty string to the field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2019 Jan 17, 2019

This sounds like my problem 100%. I looked in some forums to see if I could match some code to my scenario, basically:

if the value of ADJSTD>0, then calculate SC1BL/ADJSTD

else (leave this field blank)

But honestly I had no understanding of how to express it in script. This is literally the same division problem on 5 different materials, using the same value for ADJSTD (the adjusted standard value). So if I had a template I know I could substitute the other numerators in the correct calculations.

Currently with my equations broken, filling the form is a dream but I don't get any results I can use clinically, LOL.

Thanks to everyone for their fast replies! I do appreciate it!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2019 Jan 17, 2019

I came up with a low-tech solution, since I am not a programmer. I'm pre-loading the form with a "1" in each of the fields for the blank readings. That way, the only field in the form creating a denominator is always at least 1! So far as I can tell it's working fine now. Maybe one day I will learn enough to code, to advance this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2019 Jan 17, 2019
LATEST

That's not a good solution. If a user clears one of those fields, the problem will return.

The code required to do it is very basic and has been posted on these forums many times in the past. Try searching for it...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines