Hello,
I have a text field with select list with the below allowed values of countries which will be required. I want several countries to be at the top, then a space or ---------, then followed by the remaining countries in alphabetical order. But I don't want the blank line between Ireland and Afghanistan to be a selectable choice because I don't want a blank line to be shown as the country, but also want to add the space to separate the countries at the top with the remaining countries below it.
Would anyone be able to help?
Thank you!
USA
UK
Canada
Australia
New Zealand
Ireland
Afghanistan
Albania
Algeria
Angola
Antigua & Barbuda
Argentina
Armenia
Austria
Azerbaijan
Bahrain
Bangladesh
Belarus
Belgium
Benin
Bhutan
Bolivia
Bosnia and Herzegovina
Botswana
Brazil
Bulgaria
...
Comments
Comment #1
YK85 CreditAttribution: YK85 commentedI realized there can't even be a blank line in the select list to separate like the example above when the field is *required*
I would really appreciate your help!
Comment #2
cwebster CreditAttribution: cwebster commentedI think this is probably the closest you can get with the currently available functionality:
In the settings for your field, right under the "Allowed Values" text area, fold down the "PHP Code" fieldset. Then, paste the following, minus the <?php ?> tags:
Or you could do something like...
Hope that helps.
Comment #3
YK85 CreditAttribution: YK85 commentedThanks for your advice. However, it makes the select list like below:
What I'm trying to achieve:
Comment #6
drup1982 CreditAttribution: drup1982 commentedSame question but I will add the following:
is it possible to make certain value lines non selectable? In the example below can we make Asia and Europe non selectable?
Thanks,
--Asia--
Afghanistan
Albania
Algeria
Angola
Antigua & Barbuda
Argentina
Armenia
Austria
Azerbaijan
Bahrain
Bangladesh
--Europe--
Belarus
Belgium
Benin
Bhutan
Bolivia
Bosnia and Herzegovina
Comment #7
brianbrarian CreditAttribution: brianbrarian commentedFor the benefit of anyone still looking for an answer to this question (as I was today) ...
Setting the key of the non-selectable item to NULL appears to work.