Loading data in forms


I require to display the data in dropdown field 2 based upon the value selected in dropdown 1.
Is there any option to do that based upon the changes


I was unable to find any built-in method for that in cakePHP, you can use simple Jquery function to achieve that functionality.

Here is the code


$someVariable = $("#dropDown-1-d option:selected").val();
$("#dropDown-2-id option[value='"+$someVariable+"']").attr("selected","selected");


In my above example, I am assuming that the values I want to be selected have same ‘value’ attribute. for e.g.
if value=“1” is selected from 1st dropdown then select value=“1” for 2nd dropdown as well.

Change the selection criteria as per your requirement.


Thank you, I require the data to be filled from the database. How to do it


dereuromark has some nice examples:

its work like this: $("#combobox1").change() do a ajax request passing the selected value for Controller function that do database search and return a json/html data to fill the combobox2

for code search in github: