I actually ended up creating a .js file to hold my functions and initiated
my Ajax with 'onChange' => someFunction(); I pulled the field value into the
script and passed that into the controller action as a named param. etc.
etc. etc. (the entire process seemed a bit unnecessary and long-winded) The
bottom line is that it worked (for the field that was NOT created
dynamically). I repeated the process for the newly generated form field
which in turn did not work. No matter what I try I just can't retrieve any
data from form fields that get generated dynamically and thus the query
fails.

I'll take another wack at it using the suggestions you made and see how I
make out.

Yes, there are separate tables for country, state, and city. I believe I
have the associations set up correctly but who knows, I've been managing to
make a mess of everything else ;) Region and country are my foreign keys
however they are RegionID and CountryID in the db ... I'll change them to
region_id and country_id. The naming conventions in Cake take a little
getting used to.

On Tue, Mar 23, 2010 at 6:39 AM, WebbedIT <p...@webbedit.co.uk> wrote:

> To make things easier, lets strip this back to the core requirements
> then you can add in your specific formatting afterwards
>
> $form->input('User.country_id', array('empty' => '-- Select --'));
> echo $ajax->observeField('UserCountryId', array('url' =>
> 'countrySelect', 'update' => 'countryAction'));
>
> This should trigger an ajax call to /app/users/countrySelect which
> sets a $regions array and renders /app/view/users/country_select.ctp
> using the ajax layout (you've obviously managed to get this far).  /
> app/view/users/country_select.ctp view could look as simple as
>
> $form->input('User.region_id', array('empty' => '-- Select --'));
> echo $ajax->observeField('UserRegionId', array('url' =>
> 'regionSelect', 'update' => 'regionAction'));
>
> I have switched everything back to using cake's conventions, as it's
> much easier to learn cake that way.
>
> I imagine both the country and region fields are foreign_keys linking
> to tables containing the Countries and Regions which are in turn
> related to allow you to know which regions to show for which country
> etc.  All foreign keys should have _id after them and form->input will
> automagically look for a countries array if a field is called
> country_id and a regions array for the field region_id.
>
> HTH
>
> Paul.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe from this group, send email to cake-php+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to