Skip to main content
Known Participant
October 28, 2022
Answered

The Value Entered does not match the format of the field. on Form

  • October 28, 2022
  • 5 replies
  • 5641 views

Hello All,

I am new user of Adobe Acrobat. today I create a form on which I am facing a issue aboe mention. I also checked the old rolsution here but I could not understand it. so here I am expalining my issue in details.

Actually I have 4 calculated fields with names Amt3, plt1,Amt4 and Amt15

Amt3 = Amt1 + Amt2

Amt4 = Amt3/plt1*100     (to caluclate percentage)

Amt15 = Amt3 - Amt4

 

I am also attaching the image. Please someone help me on this. thanks

 

This topic has been closed for replies.
Correct answer Thom Parker

Hello,

any update about this thread? I have sent you file too.


Change the calculation in Amt15 to this

 

 

var nAmt = this.getField("Amt3").value  - this.getField("Amt4").value;
if(nAmt < .001)
   nAmt = 0;
event.value = nAmt;

 

 

Now you will get the correct value and once you've verified that. Add the formatting back in.

 

Now about formatting. Formatting does not change the value of a field, it only changes how the value is displayed. So there is no way formatting can correct a value.  Nor should it. The values are what they are and you should always make sure the calculations are yielding correct result before the formmating is applied. 

 

 

5 replies

Thom Parker
Community Expert
Community Expert
October 31, 2022

So there are some problems on this form that get in the way of debugging.

Field "Amt1" contains a calculation using field names that do not exist on the form. This is the source of the calculation error.

Field "pct1" uses a Mouse Exit event with a non-sensical scripts.

 

The formatting issue is caused by Amt15 calculation resulting in a value that is so close to zero that it uses exponent notation.  The built-in formatting isn't handling this notation.  However, if the calculation is written out as a script, this doesn't happen.   

 

The advice in the article is valid. Start simple, don't include formatting until the end. And you should never keep around useless scripts. Remove everything from the form that is not necessary for debugging the issue. 

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
October 31, 2022

I did all these thing. I make AMt1 correct. and also remove script from pct1. but still same issue

Bernd Alheit
Community Expert
Community Expert
October 29, 2022

What does you get when you change the format of this field to None?

Known Participant
October 30, 2022

no effect 

Bernd Alheit
Community Expert
Community Expert
October 31, 2022

I doesn't get the message.

Legend
October 28, 2022

This all hinges on plt1 but you haven't told us anything about how it is calculated. Maybe share the current form (exactly as it failed)

Known Participant
October 28, 2022

Hi

I already told about ptl field. it is not calcualted here. I mean user just entered 10 or 100 in this field. but this field will calculated in other field using a formula. Amt3/100*ptl. I hope you get my point.

Legend
October 28, 2022

We have seen this sort of problem many, many times. It is best if you do not try to guess what is important or not. HOW DOES ptl GET ITS VALUE? WHAT IS THE INITIAL VALUE? WHAT STOPS IT FROM BEING BLANK, ZERO, OR THE WRONG NUMBER?

Thom Parker
Community Expert
Community Expert
October 28, 2022
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
October 28, 2022

I have done this too.

did you read my last two replies?

Nesa Nurani
Community Expert
Community Expert
October 28, 2022

Problem is probably in Amt4 field you need to check that plt1 is not 0, or you will get error when trying to divide with 0, instead use this as custom calculation script:

var amt = Number(this.getField("Amt3").valueAsString);
var plt = Number(this.getField("plt1").valueAsString);
if(plt == 0)event.value = 0;
else
event.value = amt/plt*100;

 

Do you use any other script to add percentage sign, perhaps?

 

 

Known Participant
October 28, 2022

Hello

thanks for reply. I put this code and I got the same error. No i am not using other script to add percentage sign.

Actually plt get only two values from customer like 10 or 100 (percent) and then I used the formula to get the value for Amt4 (Amt4 = Amt3/plt1*100 ).

and in the end I just put Amt3 - Amt4 to get the value for Amt15. that's all