Select box preselect requires fruit |
Select box preselect requires fruit |
Brian Chandler |
Jul 10 2021, 03:08 PM
Post
#1
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
I have a truly bizarre problem with a selectbox. I generate a list of countries (two-letter codes and names); and get either a preselected country, or the result of geolocation for the likely country. So the selectbox list has "selected" added after the country that should appear as the initial selection. Here's the page - sorry, it is a total mess in progress - please scroll down to the green box:
https://imaginatorium.com/basket.php?ref=%2Fnota.html The list starts with Andorra, and should have Brazil selected. This works on both of the test pages (here the "fruit" turns out to be cars): https://imaginatorium.com/test.php?ghoti=fruit https://imaginatorium.com/test.php?ghoti=nofruit But on my page the "selected" is ignored, and Andorra shows, *unless* I precede the selectbox with a "fruit" selectbox copied from somewhere. So the real one (in the green box) shows Andorra. But the copy lower down in a red box, preceded by "fruit" correctly shows Brazil. I have tried a number of checks. Originally I wrote the select like this; <select ...> <option value=ad>Andorra <option value=ar>Argentina <option value=au>Australia ... <option value=br selected>Brazil ... And I have tried quoting the args, adding closing </option>, putting the whole thing in a (blank) <form> tag, and endless variations on copying bits to see where they would or would not work. I also tried changing the ids, in case some errant javascript was changing it. But I have totally run out of ideas. Help! |
pandy |
Jul 10 2021, 05:15 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I see Brazil in both the green and red box when I go to that page.
|
Brian Chandler |
Jul 11 2021, 02:54 AM
Post
#3
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Thanks Pandy. I *think* I may have found the problem. Is it that F5 does not reload the page. What F5 does (???) is to reload the page, and then replicate whatever selection you had in the box. In other words F5 is not reloading the page for debugging purposes. .....?????
|
Christian J |
Jul 11 2021, 03:39 AM
Post
#4
|
. Group: WDG Moderators Posts: 9,650 Joined: 10-August 06 Member No.: 7 |
What F5 does (???) is to reload the page, and then replicate whatever selection you had in the box. That seems to be the case in Firefox and MSIE, but pressing the Enter key in the address field seems to reset a SELECT menu too. Edge, Vivaldi and Brave reset it with F5 alone. |
Lo-Fi Version | Time is now: 18th April 2024 - 12:37 AM |