Skip to main content
Participating Frequently
March 11, 2022
Question

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

  • March 11, 2022
  • 2 replies
  • 1446 views

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

This topic has been closed for replies.

2 replies

Nesa Nurani
Community Expert
Community Expert
March 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.

 

Participating Frequently
March 11, 2022

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

Bernd Alheit
Community Expert
Community Expert
March 11, 2022