Calculated Field

Good morning,

We need to have a calculated field in one of our custom forms. I thought I was on the right track with the following code. I placed the code in the OnLoad event of the form, but it does nothing.

if (typeof FWeightedValue == "undefined") {
 FWeightedValue = {};

FWeightedValue.CalculateBalance = function () {
 var EstRev          ="estimatedvalue").getValue();
 var RiskWeight      ="cpdc_riskweight").getValue();
 var RiskPercent     = RiskWeight/100
 var RiskWeightValue = FWeightedValue.NullCheck(EstRev) * FWeightedValue.NullCheck(RiskPercent);"cpdc_riskweightedvalue").setValue(RiskWeightValue);

FWeightedValue.NullCheck = function (value) {
 if (value == null) {
  return 0.0;
 else {
  return value;

Can anyone see what I am doing wrong here, or do I have to call the function or ??????


Thanks in advance