Friday, August 10, 2007

Problems with read-only fields...

When creating javascripts in general and when working with AJAX-based javascripts (javascripts that access server based information) specifically, it is not uncommon to update attributes in CRM-forms. If these attributes are “Disabled” using the form-editor or are disabled using javascript in with the following code:

crmForm.all.xxx_myfield.Disabled = true;

Then any updates to the data of this field, will NOT be saved when the form is saved. There is a way to bypass this and this is to set the attribute to “Read only” instead, with the following javascript code:

crmForm.all.xxx_myfield.readOnly = true;

This will disable any editing of the field by the user, but any data that is modified will still be saved.
I have some other stuff I will share with you soon aswell.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB
www.humandata.se

2 comments:

  1. Thanks Gustaf - you've just saved me a whole load of pain!

    Tamim

    ReplyDelete
  2. Nice that such an old posting still can be useful!

    ReplyDelete