Now on change it should refresh the page and have appended ?prov=XX to the URL which then gets used in a second form.
However, my problem is that since the form is set to use "onchange" if a user wants to select the FIRST element in the list (ex: British Columbia) it won't let them, they have to select a different element first and then go back to British Columbia.
Now, I have been reading up on this and it seems like it's a quite common beginner flaw, yet I haven't been able to find one thread anywhere where this problem is addressed and actually solved.
I have a suggestion for your dropdown select form element, a good best practice for websites and web applications is to make sure that you have a default option with a null value as the first option that appears in the select control, this way if a user submits the form without selecting an option, they dont get an actual data item being selected by default. A short message in the option like "Please Select" informs the user they must select an option from the dropdown list. One thing you could do is have the form like this with a null value option as the first option:
You can validate with Javascript and also server side with whatever web programming language you are using, such as ASP.NET, PHP, or ColdFusion, writing the code so that no action is taken if the value of the PROV form element is null, or equals ""
And then I wrote a javascript function to check to see what the input was using:
Code:
function handleProvInput()
{
var Index = document.chooseProv.prov.selectedIndex;
if (Index != 0)
{
document.chooseProv.submit();
}
else
{
alert("You have to choose a valid province!");
}
}
Bookmarks