This is taken from the examples module(http://drupal.org/project/examples). More specifically in the 'Generate textfields' ajax section. The form attempts to demonstrate an ajax call by presenting 2 checkboxes and generating a textfield based on which checkbox was clicked.
This is the ajax callback. We have a textfield with key 'first_name'.
function ajax_example_autotextfields_callback($form, $form_state) {
$a = $form['first_name'];
$a['first_name']['#value'] = 'foobar';
$a['first_name']['#disabled'] = TRUE;
return $a;
}
The form rendered has value textfield with value 'foobar' as expected, but the textfield is not disabled? How come?