tags:

views:

205

answers:

2

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?

+1  A: 

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.

Mercure Integration
+1  A: 

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

David Vidmar
Are you still able to put the cursor in that box after you have called .Disabled = true; on it? I was still able to and that's what I'm trying to get away from.
mwright
Yes, I am. But I'm not able to change anything. I would call this "a feature" since it lets you copy data from that field.
David Vidmar
I can see that for some cases and it's not something I had thought about. Thanks!
mwright