I am new to NuBuilder, but so far have been very impressed with what I've been able to put together in a short space of time.
Now, I am on to updating fields on the screen in Javascript, and am in need of examples of code that run from form events would do that. Specifically, I have a subform of charges and payments. The fields of the related table are 'date', 'type' (charge or payment), and 'amount'. I want to write Javascript for an onchange event in the 'amount' field such that if the 'type' is 'payment', the amount will be negative. But I can't figure out how to either retrieve or set the field values. I tried this Javascript code based upon examples in the documentation, to no avail:
Code: Select all
if( $('#type').val() == 'Charge' ){
var Amt = Math.abs($('#amount').val());
}
else
{
var Amt = Math.abs($('#amount').val())*-1;
}
$('#amount').val(Amt);
Thanks,
Gib