Skip to main content
Henry.Ong
Inspiring
July 21, 2018
Answered

How to resolve "“The value entered does not match the format of the field [x]”?

  • July 21, 2018
  • 2 replies
  • 37962 views

I have a PDF form with several computed fields:

Field A (How many people?)

-          Input field

-          Format : Numeric (whole number)

Field B (How many days?)

-          Input field

-          Format: Numeric (1 decimal place)

Field C (Total Meal Money)

-          Computed (Field A*Field B*30)

-          Format: $ with 2 decimal places

Field D (Meal / Person)

-          Computed (Field C/Field A)

-          Format: $ with 2 decimal places

Field E (Fuel Money)

-          Input field

-          Format: $ with 2 decimal places

Field F (Emergency Money)

-          Input field

-          Format: $ with 2 decimal places

Field G (Total Cash Requested)

-          Computed (Field C+Field E+Field F)

-          Format: $ with 2 decimal places

I also have created a Reset Form button that runs the following JAVA script:

if(4==app.alert("This action will clear all input fields in this form.\nDo you want to continue?",1,2))this.resetForm()

My issue is that I am getting a Warning which says…

“The value entered does not match the format of the field

a)      each time I click the Reset Form button

b)      when Field A is zero (0) and try to change the value of Field B, Field E or Field F

I noticed that this warning happened when the value of Field A is zero (0).

2 replies

Participant
August 25, 2020

These solutions work for me to remove the error from the divide by "0", but now the calculation is not calculating properly. 

Below is my current calculation script. ultimately it is adding "1" to the final output and not completing the "*100" step.

For example, if the current rate is 25 and the new rate is 26, it was calculating the percentage increase correctly at 4.00%, then I added the suggested solution in italics, and the new result of the calculation is now 1.04. How do I get it to go back to calculating correctly to 4.00% without the divide by 0 error?

 

event.value = ( this.getField("New Hourly Rate").value - this.getField("Current Hourly Rate").value ) / ( this.getField("Current Hourly Rate").value ) * 100;
var nPeople = this.getField("Current Hourly Rate").value;
if(nPeople != 0) {
event.value = this.getField("New Hourly Rate").value / nPeople;
} else {
event.value = "";
}

try67
Community Expert
Community Expert
August 25, 2020

The first part of your code doesn't make sense. It gets completely overwritten by the second part, no matter what the values are. Why are you using it?

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 21, 2018
Henry.Ong
Henry.OngAuthor
Inspiring
July 21, 2018

Thanks for this solution.

Inspiring
July 21, 2018

To see the actual value of the field without any formatting, set the "Format" to "None". An empty string .,like a blank field, is considered a null value and a null value within a numeric calculation is treated as zero, 0.