Showing posts with label readonly field. Show all posts
Showing posts with label readonly field. Show all posts

25/10/2011

jQuery readonly drop downs

Normally in SharePoint we would render a field or column as readonly by using the simple 'readonly' attribute.

********************** readonly field ***********************************
$("input[title='Some Field Name']").attr('readonly','readonly');

This is Ok for input fields but jQuery doesn't support the readonly attribute for drop down lists so you may be tempted to use the disable attribute

*********************** disable a field **********************************
$("select[title='Some Field Name']").attr('disabled','disabled');

However disabling a select control means that when you click Ok the actual value is not posted in the form and consequently the select value is not passed into the SharePoint column