Skip to main content
Participant
July 25, 2017
Answered

The value entered does not match the format of the field

  • July 25, 2017
  • 2 replies
  • 2903 views

I am trying to calculate a percentage (LOAN TO NET WORTH RATIO) and with the help of these forums and google, I found a script which calculates correctly however the form user will get an error message “The value entered does not match the format of the field [Loan to Net Worth Ratio]” 

The user can click OK to bypass the message and continue but obviously this is not ideal.

The script I am using is:

var a =this.getField("A");

var b =this.getField("G");

event.value=(a.value/b.value:

The A field = LOAN AMOUNT which is a sum of all of the assets that are filled in the to appropriate asset section. The G field = TOTAL NET WORTH which subtracts the total Assets from the TOTAL LIABILITIES field.

I have searched and searched these forums and tried many different javascripts but I can't seem to figure out how to fix. If anyone is able to assist I would be most grateful.

Thank you!
Mandy

This topic has been closed for replies.
Correct answer Bernd Alheit

This happens when b.value is zero.

2 replies

Inspiring
July 25, 2017

Empty fields are treated as having a value of zero. You need to use the Custom JavaScript calculation to include program flow control statements to avoid division by any value or variable that could possibly be zero or a null string. It is also possible that the result of your division is too small or too large to be displayed by the number format. Set the format of the field to "None" and observe the answer.

var a =this.getField("A");

var b =this.getField("G");

if(b.value != 0)

{

  // perform division;

   event.value=(a.value/b.value:

} else {

  // do not divide by zero;

   event.value = "";

}

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
July 25, 2017

This happens when b.value is zero.