I really need to remove "NOT LISTED" from the state select list. It's confusing for my users. I have instructions for them to clear all fields so that no address (or map) is displayed. But they immediately think that "NOT LISTED" is what they should select to clear the field. They don't think to set it to "Please select."

I've tried using the "Delete" box, but that doesn't work because once a user "deletes" their location the location form can be submitted even if fields are required. (NOTE: I have some locations that are required and some that are not. As far as i know the "delete" box function is global?) I removed the code for the delete function completely to eliminate that confusion. I would be nice to see the delete function as an option to set per field.

Is there anything I can do to remove "NOT LISTED?"

Thank you in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tucho’s picture

Status: Active » Closed (works as designed)

Maybe a little too late, but you can use the hook_location_element_alter hook to delete de options:

/**
 * Implements hook_location_element_alter().
 */
function YOUR_MODULE_location_element_alter(&$element) {
  unset($element['province']['#options']['xx']);
  unset($element['country']['#options']['xx']);
}
ropic’s picture

It works, thank you.

nielsonm’s picture

The location element alter works on page load for me, but when the form reloads in AJAX, the 'NOT LISTED' text reappears. I went ahead and patched the module to remove the option.

nielsonm’s picture

Category: Support request » Bug report
Status: Closed (works as designed) » Needs review
legolasbo’s picture

Retesting to see if the patch still applies correctly