How do you add in a non pickable blank line on a drop down list?

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Anti-Spam Guide
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
User avatar
Crusoeman
Registered User
Posts: 64
Joined: Wed Nov 12, 2014 10:46 pm

How do you add in a non pickable blank line on a drop down list?

Post by Crusoeman »

For a forum build in phpBB 3.1.10 Prosilver.

Re: Drop down list on registration form.

How can you add in a blank line without that line then becoming an option?

e.g.

Currently:

Choose
Australia
Austria
Belgium
Etc.


Change to:

Choose
- - - - - - - < Blank line here. Not a pickable option. i.e. It is a dead option.
Australia
Austria
Belgium
Etc.


Tim
User avatar
MohamedAG
Registered User
Posts: 107
Joined: Mon May 26, 2014 10:06 pm
Location: U.S.A.
Name: Moh Sal
Contact:

Re: How do you add in a non pickable blank line on a drop down list?

Post by MohamedAG »

If you are trying to force people to click on the drop-down menu and select something and not just go with the first choice.....
They will still could do the same
and the value that would be passed will be "-------"

if you still want to do it .. and I think you're talking about the time zone option....
you'll have to edit
timezone_option.html
and add

Code: Select all

<option value="-------">---------</option>
after the select html tag

However that value will still be passed even if the user didn't change it.
User avatar
Crusoeman
Registered User
Posts: 64
Joined: Wed Nov 12, 2014 10:46 pm

Re: How do you add in a non pickable blank line on a drop down list?

Post by Crusoeman »

Thanks Moh. Yes we do want them to make a selection. They can't ignore the question and skip to the next one. You mention timezone. Yes, similar, we want to know what country they are from and they have to pick from the drop down list we give them. So they HAVE to pick from Australia, Denmark, United States, France or wherever. Picking '----------' is not an acceptable option and they would have to try again.

Tim
User avatar
MohamedAG
Registered User
Posts: 107
Joined: Mon May 26, 2014 10:06 pm
Location: U.S.A.
Name: Moh Sal
Contact:

Re: How do you add in a non pickable blank line on a drop down list?

Post by MohamedAG »

There is this tutorial on adding a custom field
https://www.phpbb.com/support/tutorials ... .php?tid=5
it might just do the trick.

you could also use the "disable" option in option
http://www.w3schools.com/tags/att_option_disabled.asp

Code: Select all

<select name="somename">
  <option disabled="disabled" selected="selected">Select an option.</option>
  <option>Australia</option>
  <option>Austria</option>
  <option>Belgium</option>
</select>
However I don't think that phpBB supports a disabled option in drop-down list out of the box yet
thus an if-else php code will be needed.
User avatar
Lumpy Burgertushie
Registered User
Posts: 68282
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: How do you add in a non pickable blank line on a drop down list?

Post by Lumpy Burgertushie »

it works just fine out of the box. you just have to add that line to whatever selection box code you want.

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
Crusoeman
Registered User
Posts: 64
Joined: Wed Nov 12, 2014 10:46 pm

Re: How do you add in a non pickable blank line on a drop down list?

Post by Crusoeman »

Thanks Moh and Robert for your thoughts on this. I now more fully understand this and as Robert says it works straight out of the box. Well it does, except that it still throws up one problem for me.

Under 'Profile type specific options' you can only opt for one field to be non valid, not more. It's obvious in my example that 'Choose' is non valid and that is what we have gone for. However if I put in a blank line or say '-----------' that line remains an option. Unless someone knows a way round this I think it's just something that we will have to live with. Should anyone try and register with '----------' as a country it should get picked up when they seek approval to join the forum.

e.g.
Choose
- - - - - - - < Blank line here is a non valid option.
Australia
Austria
Belgium
Etc.
Profile type specific options.JPG
Tim
User avatar
MohamedAG
Registered User
Posts: 107
Joined: Mon May 26, 2014 10:06 pm
Location: U.S.A.
Name: Moh Sal
Contact:

Re: How do you add in a non pickable blank line on a drop down list?

Post by MohamedAG »

There is an extension in development and maybe the author will be willing to add that feature to it.

viewtopic.php?f=456&t=2327001
User avatar
Lumpy Burgertushie
Registered User
Posts: 68282
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: How do you add in a non pickable blank line on a drop down list?

Post by Lumpy Burgertushie »

you need to replace the blank line with your line that says "choose"

then it will show up as non active and when clicked will drop down the box and you then choose from one of the options.
you don't need one line that says choose and one line that has the ------- in it for blank line.

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
Crusoeman
Registered User
Posts: 64
Joined: Wed Nov 12, 2014 10:46 pm

Re: How do you add in a non pickable blank line on a drop down list?

Post by Crusoeman »

Robert I understand what you say but I'll need to explain a little more about our proposed list of countries. It's something I have seen done this way before. Circa the first 30 countries on the list are the most likely to be where forum users registering are from. It will save the majority of those registering having to scroll down a very long list. After that list finishes there will be a secondary list of the rest of the countries in the world where it's just possible that a forum user might be from. I had in mind separating the first list from the second either by a blank line or a '------------' line. Maybe I should have explained this in the first place.

It would look something like this:

Around 30 countries finishing with
Norway
Portugal
South Africa
Spain
Sweden
Switzerland
United Kingdom
United States
-----------------
Afghanistan
Albania
Algeria
American Samoa
Andorra
Angola
etc, etc.

I'll agree that it's not essential but we all strive to make websites and forums as user friendly as possible.

Tim
Pond Life
Registered User
Posts: 388
Joined: Sat Jan 20, 2007 1:55 am

Re: How do you add in a non pickable blank line on a drop down list?

Post by Pond Life »

I have used a 'Country' custom field for many years now, required on registration. It works fine and nobody has found it confusing or difficult. My board is in English and the main target area is the UK so this is my version of the 'entries' field...

Code: Select all

--- Please Select ---
England
Ireland
Scotland
United Kingdom
United States
Wales
--- Please Select ---
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua And Barbuda
Argentina
Armenia
Aruba
Australia
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Canada
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (keeling) Islands
Colombia
Comoros
Congo
Congo, The Democratic Republic Of The
Cook Islands
Costa Rica
Cote D'ivoire
Croatia
Cuba
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-bissau
Guyana
Haiti
Heard Island And Mcdonald Islands
Honduras
Hong Kong
Hungary
Iceland
India
Indonesia
Iran
Iraq
Ireland
Isle Of Man
Israel
Italy
Jamaica
Japan
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Democratic People's Republic Of
Korea, Republic Of
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Libyan Arab Jamahiriya
Liechtenstein
Lithuania
Luxembourg
Macao
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia
Moldova
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Norway
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint BarthÉlemy
Saint Helena
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Pierre And Miquelon
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Singapore
Slovakia
Slovenia
Solomon Islands
Somalia
South Africa
South Georgia And The South Sandwich Islands
Spain
Sri Lanka
Sudan
Suriname
Svalbard And Jan Mayen
Swaziland
Sweden
Switzerland
Syrian Arab Republic
Taiwan
Tajikistan
Tanzania
Thailand
Timor-leste
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United Kingdom
United States
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Venezuela
Viet Nam
Virgin Islands, British
Virgin Islands, U.s.
Wallis And Futuna
Western Sahara
Yemen
Zambia
Zimbabwe
The result looks like this...
country.png
country.png (17.26 KiB) Viewed 841 times
Never argue with idiots, they will drag you down to their level and beat you with experience.
User avatar
Crusoeman
Registered User
Posts: 64
Joined: Wed Nov 12, 2014 10:46 pm

Re: How do you add in a non pickable blank line on a drop down list?

Post by Crusoeman »

That's it Pond Life, you've got it!

One observation is that '------Please Select ------' looks better than 'Choose' so we'll try that.

Many thanks.

Tim
Locked

Return to “[3.1.x] Support Forum”