This only works on required fields.

For example, if the user can only select United States, then just show United States in text instead of the dropdown.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Title: Replace the country dropdown with a text item if only 1 option is available » Hide the country dropdown when it has only one option

Actually, reviewing notes and discussing internally, it makes more sense to hide the dropdown without showing any replacement, instead of showing the value in text instead.

vasike’s picture

Status: Active » Needs review
FileSize
2.02 KB

there is patch for this:
- use hidden form element for single available country, using its country code as value.

  • bojanz committed a8f8682 on 8.x-1.x
    Issue #2581155 by bojanz, vasike: Hide the country dropdown when it has...
bojanz’s picture

Status: Needs review » Fixed

Added tests, missing required field check, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.