Pages

Monday, December 14, 2009

Fire an event on any CRM field change

The following code shows how you can attach any function to all of the fields on a CRM form for execution when any of them change.  It's based on Michael Höhne's code to find all fields on a form:

FieldChange = function () {
  alert("Change!");
}

for (var index in crmForm.all) {
  var control = crmForm.all[index];
  if (control.req && (control.Disabled != null)) {
    control.attachEvent("onchange", FieldChange);
  }
}

No comments:

Post a Comment

Unrelated comments to posts may be summarily disposed at the author's discretion.