Thanks Ed :)
Ok, off the top of my head - I see that every other form field you
specify as:
[code]
$form->input('fieldname', ...);
[/code]
Note, you use only the fieldname without the modelname.
But for the region, you attach Search as the modelname! Have you tried
to remove it?
Does the region view (the one which is returned using Ajax) only
contain the form field without having a form create and end?
What does the HTML look like, when the region is first populated after
you choose a country? Is it defined as:
[code]
... name="data[Search][region]" ...
[/code]
You have to make it look like the other fieldnames! (I assume they
differ!)
Enjoy,
John
On Jun 16, 10:58 am, Ed Propsner <[email protected]> wrote:
> Sorry about that John, I'm not quite with it today ... i'm a bit under the
> weather.
> This is the part of the view for the search.
>
> $form->input('country', array(
> 'label' => '',
> 'type' => 'select',
> 'empty' => '-- Select --',
> 'selected' => $this->Session->read('Auth.User.country')
> )
> )
>
> $ajax->observeField('SearchCountry', array(
> 'url' => array(
> 'action' => 'getRegion'
> ),
> 'frequency' => 0.1,
> 'update' => 'displayRegion'
> )
> )
>
> Upon 'onchange' event the selected country id is passed to the controller
> where it queries a new list of regions for that country.
>
> The controller passes the array of regions to a separate view (perhaps could
> have done this differently?) where a new select element is populated with
> the array of regions.
>
> $form->input('Search.region', array(
> 'label' => '',
> 'type' => 'select',
> 'options' => $region
> )
> );
>
> The 'region' select element in the search form sits inside a div and is
> overwritten by the above element.
> The new select element is getting passed into the search form as $this->data
> which makes sense but it's also remaining
> that way when the form submits.
>
> So now with using GET the form submits as
>
> [minAge] => 31
> [maxAge] => 41
> [country] => Chile
> [data] => Array
> (
> [Search] => Array
> (
> [region] => Libertador General Bernardo O'Higgins
> )
>
> )
>
> I straightened out the array once the form is received by the
> controller but the form has already submitted at that point and it
> leaves my url
>
> looking like " country=Chile&data[Search][region]= " on the results
> page. I still utilize the data from url on the results page so
>
> data[Search][region]= is throwing it off especially if the user sorts
> the data and the url switches back to "region=" as it was originally
> intended.
>
> I feel like this didn't help any 8-), let me know if I'm still being too
> vague.
>
> - Ed
[snip]
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en