Skip to main content
mariej97441354
Participating Frequently
July 11, 2017
Answered

The value entered does not match the format of the field

  • July 11, 2017
  • 1 reply
  • 7904 views

I have set up some basic formulas in my PDF.  Example....I have a Swing field and a Cycles field.  In the Cycles field under calculate I have a Simplified field notation:  (60*60)/Swing  The formula works fine but I have to have a number in Swing or it gives me a The value entered does not match the format of the field [Cycles]  - the format in Cycles is set up as a Number.  What do I need to change to be able to have a blank in Swing?

This topic has been closed for replies.
Correct answer Karl Heinz Kremer

JavaScript for Acrobat is not the same as JavaScript for the web - that makes it a bit harder to find a good resource. Take a look here for a book that is dedicated to Acrobat's JavaScript: Beginning JavaScript for Adobe Acrobat

Here are some general resources: Learning to Program JavaScript for Adobe Acrobat - KHKonsulting LLC

Then, once you are familiar with JavaScript, you need to work with the Acrobat JavaScript documentation in the Acrobat SDK.

The "Maximum" field should be fine, but take a look at the script for Efficiency, and convert that to something similar to what I presented above.

1 reply

Karl Heinz  Kremer
Community Expert
Community Expert
July 11, 2017

When there is no value in the "Swing" field, the value returned for an empty string is 0, which means you are dividing by zero - which results in "NaN" - or "Not a Number". This is - as the name suggests - not a number, and therefore does not fit into the number format that you associated with the field. There are two ways around this: You can either use a custom formatting script for your result field, or you can use a custom calculation script that will not perform the calculation when there is no valid number in the "Swing" field. I would go with the second route. Something like this should work:

var f = this.getField("Swing");

if (f.valueAsString != "") {

  event.value = (60*60)/f.value;

}

else {

  event.value = "";

}

mariej97441354
Participating Frequently
July 11, 2017

The calculations are still working using that, but I still can't change Swing to a blank field.  I'm getting the value entered does not match the format of the field [Efficiency]