Skip to main content
Participating Frequently
April 9, 2021
Question

the value entered does not match the format of the field

  • April 9, 2021
  • 4 replies
  • 1910 views

Hello!

 

i have below script for calculating total months of seafarers voyages. It calculates correctly BUT i get the "the value entered does not match the format of the field" error wherever in the form i try to input data.

 

event.value = "";
var cBegin = new Date(this.getField("SIGN ONRow1").valueAsString);
var cEnd = new Date(this.getField("SIGN OFFRow1").valueAsString);

var nDiffMonths = (cEnd.getDate() - cBegin.getDate()) / 30 +
cEnd.getMonth() - cBegin.getMonth() +
(12 * (cEnd.getFullYear() - cBegin.getFullYear()));
// set field value;
event.value = nDiffMonths;

 

Any suggestions please?

This topic has been closed for replies.

4 replies

Thom Parker
Community Expert
Community Expert
April 12, 2021

Here's an article that explains the problem and how to fix it.
https://www.pdfscripting.com/public/Value-Entered-Does-Not-Match-Format.cfm?sd=40

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Bernd Alheit
Community Expert
Community Expert
April 12, 2021

The popup displays the name of the field with the format error.

Nesa Nurani
Community Expert
Community Expert
April 10, 2021

Do you get alert when try to enter date in field?

If yes, check if field is formated to date and make sure you enter date correctly.

Participating Frequently
April 12, 2021

The format of the field is date. The problem is not in the format, the error i get is when i try to input data on every single field on the form even if it is unrelated with the calculation field.

Nesa Nurani
Community Expert
Community Expert
April 12, 2021

Can you share your file?

Bernd Alheit
Community Expert
Community Expert
April 9, 2021

What format does you use? What happens when you change the format to "None".

Participating Frequently
April 9, 2021

same thing with forma to "None"

I am not very familiar with Java but i understand that i need to add another option to my script?

Bernd Alheit
Community Expert
Community Expert
April 9, 2021

Info: Acrobat uses Javascript, not Java.