Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values for Multiple select box lost

Status
Not open for further replies.

Idee

Programmer
Jul 8, 2003
51
NZ
Hi

I have a select box of country, on selecting a value in this select box, onChange event it populates a multiple selection select list for states and on selecting values in there, onChange again it populates a multiple selection select list for cities.

It is all working well except when I submit this form to another page and then click back from browser, the mutiple select box values are lost and only the value for country is still selected.

Any help is appreciated

Thanks
 

This is a browser issue, rather than a coding issue. However, you could look at doing a fix in one of two ways:

1. With server-side code (ASP, JSP, PHP, etc) you could pre-select the chosen items every time the page loads (this is the preferable solution).

2. You could pass the selected items in the URL (such as "blah.html?selItems=1,3,9,46") and use JavaScript to parse them and select the relevant items.

Method 2 relies on the user having JS enabled to work, something which may or may not matter, depending on your target browser market, desired audience, and contractual specificsations.

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top