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

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

Contributor ,
Jul 20, 2018 Jul 20, 2018

Copy link to clipboard

Copied

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).

TOPICS
Create PDFs

Views

28.2K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jul 21, 2018 Jul 21, 2018

Votes

Translate

Translate
Community Expert ,
Jul 21, 2018 Jul 21, 2018

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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
Contributor ,
Jul 21, 2018 Jul 21, 2018

Copy link to clipboard

Copied

Thanks for this solution.

Votes

Translate

Translate

Report

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
LEGEND ,
Jul 21, 2018 Jul 21, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Contributor ,
Jul 21, 2018 Jul 21, 2018

Copy link to clipboard

Copied

Following your suggestion, the computed field is showing the text "NaN" and second, I would like to see the field as numeric with two decimal places.

Votes

Translate

Translate

Report

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 ,
Jul 22, 2018 Jul 22, 2018

Copy link to clipboard

Copied

You need to solve the division by zero problem, and then you'll be able to use the Number format.

Votes

Translate

Translate

Report

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
LEGEND ,
Jul 22, 2018 Jul 22, 2018

Copy link to clipboard

Copied

For the computation of Filed D you can only perform the calculation when Field A is not zero. You will have to use the Custom JavaScript calculation option.

var nPeople = this.getField("Field A").value;

if(nPeople != 0) {

event.value = this.getField("Field C").value / nPeople;

} else {

event.value = "";

}

Votes

Translate

Translate

Report

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
Contributor ,
Jul 22, 2018 Jul 22, 2018

Copy link to clipboard

Copied

This solution also works. Great! Thanks

Votes

Translate

Translate

Report

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
New Here ,
Jul 10, 2020 Jul 10, 2020

Copy link to clipboard

Copied

I am having the same issue.  I am trying to find use cost divided by amount (example- 10oz at $15.99- need cost per ounce) but if it is a product not being used it is 0 or empty field.  How do I get that to compute?  So confused...if it was excel I would get it LOL

Votes

Translate

Translate

Report

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 ,
Jul 10, 2020 Jul 10, 2020

Copy link to clipboard

Copied

The solution described above is valid in your case, too. You have to make sure the amount is not zero before dividing by it.

Votes

Translate

Translate

Report

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
New Here ,
Aug 25, 2020 Aug 25, 2020

Copy link to clipboard

Copied

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 = "";
}

Votes

Translate

Translate

Report

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 ,
Aug 25, 2020 Aug 25, 2020

Copy link to clipboard

Copied

LATEST

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?

Votes

Translate

Translate

Report

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