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

Clearing form errors due to calculations "The value entered does not match the form of field.

New Here ,
Mar 11, 2022 Mar 11, 2022

I developed a form that is essentially a calculator. After calculating a variety of fields provides the end-user with what they need to perform other functions. I have all the calculations working and providing me the correct result, but I added a clear form button and it is throwing 2 errors on 2 fields that have division calculations. After trying different scripts that I've gleaned off of this site, I can not resolve the issue. Hoping someone can assist. I've attached the form and the errors are coming from Feild "Text23" and "Text58"

 

Thanks in Advance

TOPICS
JavaScript , PDF forms
1.5K
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 11, 2022 Mar 11, 2022
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 11, 2022 Mar 11, 2022

Error is because you try to divide with zero.

For "Text23" replace:

if(a==0)event.value="";
if(b==0)event.value="";
if(c==0)event.value="";

with:

if(b==0) event.value="";

Because var b is only one in that calculation that can divide with zero, that should fix your error. If you want field to be empty if any of the fields is empty then use like this:

if(a==0 || b==0 || c==0) event.value="";

 

For "Text58" also use custom calculation script instead of SFN and check for division with zero, you should also check your other calculations too for division with zero and correct it.

 

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 11, 2022 Mar 11, 2022
LATEST

Nesa, thank you. That worked and I have checked and changed all other SFN to custom script

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