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

'The value entered does not match the format of the field' Error - I need help

New Here ,
Mar 06, 2024 Mar 06, 2024

Hello,

 

I am currently new to the prepare forms feature and new overall to the Adobe Cloud. 

 

I have tried to create a document in which, you can calculate the percentage of the mark you achieved on a test. For instance, scoring 20 out of 40 total marks would give a result of 50%.

 

For the formula, I used the following: 

(Text66/Text67)*1

Text66 is the achieved score

Text67 is the total marks 

 

At first, it worked, but as I started to add all the other text fields, it has hissy fit and now throws up the error. 

 

Any help would be appreciated. 

 

Many Thanks in advance.

TOPICS
Create PDFs , Edit and convert PDFs , JavaScript , PDF , PDF forms
628
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Mar 06, 2024 Mar 06, 2024

When field "Text67" is empty or 0 it still tries to calculate, and you can't divide by zero so that's why error, you will have to use custom calculation script instead, and set field value to 0 if "Text67" is 0:

var t66 = Number(this.getField("Text66").valueAsString);
var t67 = Number(this.getField("Text67").valueAsString);

if(t67 === 0)
 event.value = 0;
else
 event.value = (t66/t67)*1;

What is the point of multiply by 1?

View solution in original post

Translate
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 ,
Mar 06, 2024 Mar 06, 2024

When field "Text67" is empty or 0 it still tries to calculate, and you can't divide by zero so that's why error, you will have to use custom calculation script instead, and set field value to 0 if "Text67" is 0:

var t66 = Number(this.getField("Text66").valueAsString);
var t67 = Number(this.getField("Text67").valueAsString);

if(t67 === 0)
 event.value = 0;
else
 event.value = (t66/t67)*1;

What is the point of multiply by 1?

Translate
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 ,
Mar 07, 2024 Mar 07, 2024
LATEST

Thank you so much, this has worked!

I know I am unsure too, why I multiplied by 1 which is the same answer. 

 

Thank you again. 

Translate
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