Welcome Guest, Not a member yet? Register   Sign In
Staggered filter list
#1

[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.
#2

[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.
#3

[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




Theme © iAndrew 2016 - Forum software by © MyBB