Hook form alter for Select list/checkbox
Mon, 2013-05-20 03:33
I am using profile2 module and trying to disable the editing with the following code:
function theme_form_profile2_edit_main_form_alter(&$form, $form_state) {
global $user;
$form['profile_main']['field_my_textField'][LANGUAGE_NONE][0]['value']['#disabled'] = TRUE;
}
global $user;
$form['profile_main']['field_my_textField'][LANGUAGE_NONE][0]['value']['#disabled'] = TRUE;
}
This works perfectly for the text field, What about the select list/checkbox field like Gender? It didn't work in the same way.