Thursday, September 11, 2008

CRM 4.0 Fields How To Tips

It occurred to me that most of the samples in my blog are more of a “complete solution” or too complicated. Sometimes you’re only looking for a line or two to integrate with your own code.In order to address that issue I have decided to write a series of How-To posts which are simple and usually address a specific requirement.

The how-to posts are categorized by common client side development tasks like CRM Form, CRM Fields, CRM IFRAME, CRM Lookup and so on. Each time something new comes up I’ll simply update the relevant “Repository” How-To post. If you have a specific requirement that you don’t see in my post and you feel that should be then comment on that and if it is missing I’ll share that solution when I can.

This How-To post addresses CRM Field development tasks:

Binding to a field change event.
this method is easier and more productive then putting all your code in each field onchage handler.

crmForm.all.<FieldId>.attachEvent( "onchange" , On<FieldId>Change );

function On<FieldId>Change()


Disalbe Field

crmForm.all.<FieldId>.Disabled = true; //false

Check if a field is null
Replace the <FieldId> with the proper field name

var fieldIsNull = (crmForm.all..DataValue == null);
alert( fieldIsNull );

No comments: