dynamics-crmdynamics-crm-4

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?


Solution

  • 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)