Every now and then, we need to show the data in a form field, pre-checked checkboxes, or pre-selected selection menus, which should not be editable by the user. Very often, these sort of functions are used in permissions and access control related pages.
In HTML, an uneditable form field can be created as follows:
<input type="text" readonly="readonly" name="cantedit" />
In drupal, an editable form field can be created as follows:
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('name'),
'#attributes' => array('disabled' => 'disabled'),
);