When I created my first personal CakePHP web site, this was something that had me quite frustrated. I struggled and struggled to figure out and understand how to do a simple “if I change this select box, how can I populate another one”.
I had previously done this a million times in other languages with a simple Javascript onchange() function that would do my AJAX and populate my other select box.
To solve this problem, I checked CakePHP’s web site and did not find anything useful. Don’t forget this was almost a year ago, I find the web site has come a long way now. Because I couldn’t find a could example, I did the next best thing, I dove write into the form helper and ajax helper. Shortly after, I found enough information to start my trial and error process.
Excellent, now we are getting some where. Now that we know this, let’s create our two select boxes and make our second one populate through AJAX. (more…)