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

On Wed, Jun 16, 2010 at 3:03 AM, John Andersen <j.andersen...@gmail.com>wrote:

> Please provide more details for us to consider! For a starter I think
> the following would be necessary:
> The code that returns data for your ajax call.
> The code of the view in which the dropdown data is to be used.
>
> Enjoy,
>   John
>
>
> On Jun 16, 2:55 am, Ed Propsner <crotchf...@gmail.com> wrote:
> > My last post was a bit misleading ... The way I should have stated it is
> > that using array_merge() and unset()
> > I was able to structure the array the way that I want it in the
> controller
> > action for the search results so it's not throwing
> > an error, but it is still showing in the url as >>
> > country=Chile&data[Search][region]= . The results page has a custom sort
> > so when the data is sorted the url changes back to >>
> country=Chile&region=
> > . I had to alter the controller, view, and a few elements
> > to account for the difference and to keep it from giving an error.
> >
> > What I would like to do is have $this->params array arrive at the
> controller
> > already formatted the way I want instead of me
> > having to manipulate the array once it get's there.
> [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 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
>

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

Reply via email to