Skip to main content
Participant
November 9, 2011
Question

How to change listbox content by changing other listbox

  • November 9, 2011
  • 1 reply
  • 970 views

Dear All ,

I have a problem which made me crazy. i have a listbox in my form ( <form> not <CFFORM> ) and i want if anyone select an item from this listbox so i change the items in other listbox.

the point is second listbox item should come from database .

as an example :

first listbox contain country name :

     1- united arab emirates

     2- United state of America

     3- Islamic republic of Iran

When anyone selec one of the country , the cities should be retrive from the DATABASE "Countries" and table "CITIES",

i dont want to refresh the page, i seen in many pages work with ASP they have the same code , and when you change the country , the next listbox retrive the cities name from database and will change .

Thanks

Alireza Parsa

This topic has been closed for replies.

1 reply

Inspiring
November 10, 2011

You are describing something called Related Selects.  Google that term and you'll find lot's of ways to do it and code samples.  I haven't done one in years, but this is how I last did it. 

http://www.pathcom.com/~bracuk/code/RelatedSelects.htm

Inspiring
November 10, 2011

There is also a nice plug-in for jQuery:

http://www.erichynds.com/examples/jquery-related-selects/

November 11, 2011

Thanks , i try to download and read the document file .

i hope  i can solve it