mardi 22 mars 2016

Dropdown changes values according to an upper dropdown

guys. I'm working with cakephp, html and javascript in my work, and I'm having problems with changing the values from a dropdown (select field) according to an upper dropdown, without refreshing the page by the time I select. To explain my situation, I have an array of values from a DB table called "States", connect to another table called "Citys" (I know that it's not correct to write citys, but for a DB it's better just to put an "s" instead of writing "Cities"). A State has many Cities. That's why the table "Citys" has an "idState" to reference the State it's related with. I want the user to select a state from the dropdown list. After that, a dropdown to choose the city appears, but that's not enough, I want just the cities from the state I've choosen to be listed. I know it has to be done with a JavaScript code, but I don't know how to query the database through the js code. I really don't know if I made myself clear. If not, please, ask me for more details about it.



Dropdown changes values according to an upper dropdown

Aucun commentaire:

Enregistrer un commentaire