How to remove N/A from radio button options in drupal7?
How to remove N/A from radio button options in drupal7?
If you don't want to show the N/A option in the radio buttons option lists, then make that field mandatory.
When you make that field required it will remove the N/A option.
But if you don't want to make that field required and also don't want to show N/A option, then you use theme hook function
theme_form_element($variables) to alter that.
function mytheme_form_element($variables) {
$element = $variables['element'];
// Disable radio button N/A
if ($element['#type'] == 'radio' && $element['#return_value'] === '_none') {
$variables['element']['#attributes']['disabled'] = TRUE;
}
return theme_form_element($variables);
}
you can use your theme’s name in place of mytheme in the function name, and add this function to your theme’s template.php file.
Hide using CSS:
.form-radios .form-disabled {
display: none;
}
Post a Comment