CodeIgniter Forums
Staggered filter list - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Staggered filter list (/showthread.php?tid=16627)



Staggered filter list - El Forum - 03-12-2009

[eluser]Jason Tan Boon Teck[/eluser]
I am trying to create a page for the user to generate a report. The report analyses by city. Since the list of cities is very long, I would like the user to first select STATE, to reduce the list of cities that the user can choose from.

State: [choose a state]
City : [choose a city (reduced list)]

[Print Report]
button

Is this possible with CI? What are the options? Javascript? Server-side?

Thanks in advance.


Staggered filter list - El Forum - 03-12-2009

[eluser]xwero[/eluser]
server side you have to work with a button after the state is selected. javascript you can update the city list as soon as the state is selected using ajax.


Staggered filter list - El Forum - 03-12-2009

[eluser]vitoco[/eluser]
you must attach the "onchange" event to the states select , then you have 2 options ,

1.- load the city list with ajax. sending the selected state value and retrieving only the cities that belong to that state
2.- post the form to the server, get the value of the states select and populate the city select according to that value and reaload the page ( actually sending the whole page again to the browser )

Saludos