How should I go about country and province selection in a HTML form when JavaScript is disabled?
I would normally add a disabled province select field with javascript, and when the user selects some country, ajax loads the provinces. But how can I allow users开发者_如何学编程 to pick a province without javascript?
Just add a button (other than the submit button) which posts the form back to the server.
You could have a button "Display provinces" after the country drop-down, which posts back the form to the server. On the server, you retrieve the country of the (incomplete) form, and then add the appropriate provinces to the province dropdown. The user then can select the province and hit the submit button.
When javascript is present, you may hide the button with javascript and do it all with ajax.
choose a conntry, press a button, reload the page with a GET parameter, render the page using php and show the province for that state
精彩评论