Skip to main content
Participant
October 10, 2016
Question

subtraction

  • October 10, 2016
  • 2 replies
  • 339 views

I've been trying a JavaScript that computes the remaining balance. 

The customer picks a package which assigns a price to the subtotal and when the customers enter a deposit it should generate the remaining balance.  I've tried this javascript

var t = getField(“Price”).value;

var d = getField(“Deposit”).value;

event.value = t - d;

but it is not working.

Is there anything wrong with the JavaScript?  Please help!!

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
October 10, 2016

You're using non-standard quotes. Use only straight quotes, either doube ( " ) or single ( ' ).

Inspiring
October 10, 2016

If those field names are correct, the field calculation order is correct, and you placed the code as a custom calculation script, it should work. You can check the JavaScript console for errors by pressing Ctrl + J.