Click to Rate and Give Feedback
MSDN
MSDN Library
Microsoft Dynamics
Microsoft CRM 3.0
Form Object Model
 All Field Types

  Switch on low bandwidth view
All Field Types
banner art

The following table shows the properties that are available on all fields.

General field properties Type Values
{Field}.DataValue Varies for each field type Get/set property.

Valid for all field types. Note that setting the field value in a script does not fire the OnChange event. You can use the FireOnChange field method to perform this function.

{Field}.Disabled Boolean Get/set property.

The field is displayed as read only to the user; however it can be updated by a script. This field is submitted to the server when it is modified.

Example

var oField = crmForm.all.SOME_FIELD_ID;
// Toggle the disbled state of the field
oField.Disabled = !oField.Disabled;
{Field}.RequiredLevel   Get property.

Determines the level of requirement for the field. Valid values are:

0 = No constraint (normal)

1 = Business recommended

2 = Business required

Example

var CRM_REQUIRED_LEVEL_NORMAL = 0;
var CRM_REQUIRED_LEVEL_RECOMMENDED = 1;
var CRM_REQUIRED_LEVEL_REQUIRED = 2;
var oField = crmForm.all.SOME_FIELD_ID;

switch (oField.RequiredLevel)
{
   case CRM_REQUIRED_LEVEL_NORMAL:
      alert("This field is not required or recommended");
      break;

   case CRM_REQUIRED_LEVEL_RECOMMENDED:
      alert("This field is business recommended");
      break;

   case CRM_REQUIRED_LEVEL_REQUIRED:
      alert("This field is required");
      break;
}
{Field}.IsDirty Boolean Get property.

True if the field's value has changed.

Example

var oField = crmForm.all.SOME_FIELD_ID;

if (oField.IsDirty)
{
   alert("The field's value has changed.");
}
else
{
   alert("The field's value has not changed.");
}
{Field}.ForceSubmit Boolean Get/set property.

Determines whether the value will be submitted to the server on save. All enabled fields will be submitted after they have been modified either through script or by user input.

Set this property to True for disabled or read-only fields and for fields that have not been modified if you want to submit them.


The following methods are available on all fields:

General field methods Description
{Field}.SetFocus() Sets the focus, changes tabs, and scrolls the window as necessary to show the specified field.

Example

// Set focus to the field.
crmForm.all.SOME_FIELD_ID.SetFocus();
{Field}.FireOnChange() Programmatically fires the OnChange event for the specified field.

Example

// Set focus to the field.
crmForm.all.SOME_FIELD_ID.FireOnChange();


© 2007 Microsoft Corporation. All rights reserved.


© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker