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

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

Community Beginner ,
May 07, 2021 May 07, 2021

Hi, I keep getting this error whenever the ("A" + i) fields are all blank. Can someone  kindly help me refine the script to ensure that whenever ("A" + i) are all empty, this field should remain blank as well.

Thanks.

var sum = 0;
var sumText = 0; 
for (var i = 1; i < 150; i += 1) {

    if (getField("V" + i).value == "Yes") {sum += 1}
    if (this.getField("A" + i).value != "") {sumText += 1}


event.value = sum/sumText;
}

Screenshot 2021-05-04 134047.jpg

TOPICS
JavaScript , PDF forms
1.7K
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 ,
May 07, 2021 May 07, 2021

Try like this:

var sum = 0;
var sumText = 0;
for (var i = 1; i < 150; i += 1) {

if (getField("V" + i).value == "Yes") {sum += 1}
if (this.getField("A" + i).value != "") {sumText += 1}

if(sum == 0 || sumText == 0)
event.value = "";
else
event.value = sum/sumText;
}

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 ,
May 07, 2021 May 07, 2021

Try like this:

var sum = 0;
var sumText = 0;
for (var i = 1; i < 150; i += 1) {

if (getField("V" + i).value == "Yes") {sum += 1}
if (this.getField("A" + i).value != "") {sumText += 1}

if(sum == 0 || sumText == 0)
event.value = "";
else
event.value = sum/sumText;
}

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 Beginner ,
May 07, 2021 May 07, 2021
LATEST

Thank you very much! This worked perfectly!

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