How to Remove N/A Option in Radio Button Field Drupal 7

One of the interesting Features of Drupal 7 is the Field API. Prior to Drupal 6, to make a custom field the Core Profile Module and Content Profile Modules are used. Now in Drupal 7 we can make any custom field to appear in User Registration Form.

When Adding Custom Fields Such as Gender usually we use Radio Button Input. However there is a small Problem with the core module as it displays the third option N/A in the input. To Remove the N/A option the field needs to be set as mandatory.

To Remove this option there is another way. Go to modules/field/modules/options/options.module and comment the
the code $properties[’empty_option’] = ‘option_none’ as shown below under buttons.

Note: Proper way to achieve it would be to override this function in custom module. But for a Quick Fix we can also follow this method, as we are just commenting a single line.

  1. lauraine2012 says:

    Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.

  2. Ran Bar-Zik says:

    Messing with Drupal’s core is bad idea, the most simple way to do it is with using hook_form_alter and do something like that:

    //remove all N/A options from the menu

    foreach ($form as $k => $v) {

    if(is_array($form[$k]) && isset($form[$k][‘und’][‘#options’][‘_none’])) {




    • Ramesh says:

      I really appreciate your point of view. Thanks for your suggestion. As per this example we are not writing any code core, just a single line commented out as a
      quick fix.

Leave a Comment

Your email address will not be published. Required fields are marked *