Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#3 | hide_country_dropdown_for_single_option-2581155-3.patch | 2.02 KB | vasike |
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedActually, 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.
Comment #3
vasikethere is patch for this:
- use hidden form element for single available country, using its country code as value.
Comment #5
bojanz CreditAttribution: bojanz at Centarro commentedAdded tests, missing required field check, committed.