Re: How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-31 Thread WebbedIT
Been a while since I did this but as CakePHP uses the id of each record as the key I think I did $array[0] => 'value'; ksort($array); Should work as you can't have a primary key of 0 so it should always sort to first, actually this would mess with an array sorted by a-z values. Ok, how about ..

Re: How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-30 Thread FrederickD
I think I solved my problem referenced on this thread. The solution proposed with the array_unshift scrambled the data inside the dropdown. The names were still sorted properly, but the id number with that name got resequenced. Apparently that is what array_unshift does for you, according to the d

Re: How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-30 Thread brian
In case you miss the other thread: you need to call set() before rendering the view because the view's copy of the variable is not changed otherwise. On Sun, Aug 30, 2009 at 9:33 AM, FrederickD wrote: > > I understand. That is what I would like to do; have the first row be > 'Please select...' so

Re: How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-30 Thread FrederickD
I understand. That is what I would like to do; have the first row be 'Please select...' so that the observeField 'sees' a change in the field. I am just not sure how to push an entry into element 0 of an array that has already been loaded by a find('List'), and thereby pushing all the other eleme

Re: How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-30 Thread WebbedIT
As brian states you add the blank entry to the arrays that you pass from the controller to the view. So the $states, $counties and $cities arrays need to include the blank 'Please select ...' options as their first row. --~--~-~--~~~---~--~~ You received this messa

Re: How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-29 Thread FrederickD
Thank you Brian. Yes, that is what I would like to do. What would that piece of code look like before the $this->render('/examples/ ajax_dropdown');? Is it as simple as $counties = "Please select a ..." . $counties;? I'm not sure how to insert the empty item at the beginning of the array before r

Re: How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-29 Thread brian
You have to add an empty item to the beginning of the array before rendering the options. And I suggest you put the "Please select a ..." text in a label or elsewhere and just leave the 1st option of each select list empty. On Sat, Aug 29, 2009 at 10:08 AM, FrederickD wrote: > > After hours of re

How may I 'trick' $ajax->observeField into firing with linked combo boxes?

2009-08-29 Thread FrederickD
After hours of research and trial and error, I must turn to the group for help with this. I have a series of three linked combo boxes for state, county, and city from the tutorial here: http://forum.phpsitesolutions.com/php-frameworks/cakephp/ajax-cakephp-dynamically-populate-html-select-dropdown-