mwright
mwright

Reputation: 4165

Making a field unavailable to a user with javascript in MS CRM 4

I am trying to disable a field, i.e. grey it out and not allow the user to select it. To achieve this effect I am currently calling

crmForm.all.new_attribute1.disabled = true; 
crmForm.all.new_attribute2.Disabled = true;

The Disable, with a capital D, makes the field grayed out but the user can still put the cursor in that field or tab to it.

The disable, with a little d, makes the field unavailable to the cursor and via tab, but gives no visual indication that it can't be interacted with.

Is there a better way to do this, one call that will achieve similar results or am I stuck having both there?

Upvotes: 2

Views: 1950

Answers (2)

David Vidmar
David Vidmar

Reputation: 3036

Using "Disabled" property should work.

You can try putting this code in OnLoad event of Account entity (don't forget to enable Event and Publich entity!):

crmForm.all.accountnumber.Disabled = true;

And "Account Number" will be blocked and greyed as seen in this picture:

alt text
(source: vidmar.net)

Upvotes: 2

BeardinaSuit
BeardinaSuit

Reputation: 901

You are talking about readOnly and disabled.

A great article was posted http://customerfx.com/pages/crmdeveloper/2006/03/06/readonly-and-disabled-fields.aspx ... maybe this could help.

Upvotes: 2

Related Questions