Hi I have a dropdown box for countries and want it, as a default, to have 2 countries at the top...the rest are in alphabetical order.
As the names come from a databse, I could put the order in the DB but was wondering if there is an alternative way to do this with HTML?
Robin_reala
1:31 pm on Jan 12, 2006 (gmt 0)
Nope, the order's always the order you list them in. You could adjust it with Javascript, but you'd be better off doing server-side to be honest.
jalarie
1:47 pm on Jan 12, 2006 (gmt 0)
If you're going to do anything special at all, you might consider putting those two special ones at the top and also include them in the alphabetic list. This makes it convenient for visitors from those two countries who notice them at the top, and also convenient for people who expect the list to be alphabetic, "know" that the desired entry is further down, and go down looking for it.
jackvull
1:54 pm on Jan 12, 2006 (gmt 0)
Ok, thanks. Next thing...on some sites you see them list 2 countries at the top followed by a row of -------------- e.g. UK USA --------- Afghanistan, etc.
Is the row of -------- an option element and if so, I presume you would have to check that this hasn't been selected when the form is submitted?!
jalarie
2:05 pm on Jan 12, 2006 (gmt 0)
Yes and yes. Use the "value" attribute on your options and set the value for the dashes to null.