Monday, January 18, 2010

Remove N/A option for radio buttons and select boxes in Drupal using CCK

Whenever you create a custom form fields with CCK In drupal, it is irritating us by displaying N/A for radio buttons and Selectboxes. You can remove this only through a code. goto modules/cck/modules/optionwidgets.module and find the function named optionwidgets_options() and comment the below code

if (!$field['required']) {
if ((in_array($field['widget']['type'], array('optionwidgets_buttons', 'nodereference_buttons', 'userreference_buttons')) && !$field['multiple'])
|| (in_array($field['widget']['type'], array('optionwidgets_select', 'nodereference_select', 'userreference_select')))) {
$options = array('' => theme('optionwidgets_none', $field)) + $options;
}
}

Now the N/A option is not displayed for radio buttons and select boxes.

1 comments:

Cado Magenge said...

This is a really good read for me, I must say you put your best effort for this blog.
email marketing services melbourne