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.
1 2 3 4 5 6 7 8 9 |
case 'buttons': $properties = array( 'filter_xss' => TRUE, ); // Add a 'none' option for non-required radio buttons. Removes the Annoying N/A Option Shown in Radio Button Select if (!$required && !$multiple) { // $properties['empty_option'] = 'option_none'; } break; |
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.