I have created a radio buttons field in entity form. I just want to move yes label above and No label below. How to achieve that i am not getting any option.
2 Answers
You can try hook_form_alter to reorder your field options.
function modulename_form_alter(&$form, &$form_state, $form_id){
if($form_id == 'myform_id'){
$form['field_like_event']['und']['#options'] = array(1 => 'Yes', 0 => 'No');
}
}
Note: You can change the "On" and "Off" values by interchanging "Yes" as Off value (0) and "No" as On value (1) at edit form field settings. But in general we will use 1 for "Yes" and 0 for "No". My suggestion is to use form alter method.
In field edit settings page, you can organize your options in "Allowed values list" section.
-
Thanks for your reply. But i am facing this problem when my field type in Boolean.– DRUPWAYCommented Jul 14, 2015 at 11:21