This is an example assuming you'd want this to work for adding a user.
 This could work perfectly, but I typed it by hand into this email so you
may need to debug some.

app/States/ajax_list.ctp

Contains

<?php foreach ($ajaxFunctions as $key => $value): ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php endforeach; ?>

app/Users/add.ctp
Contains
<?php

$this->Js->get('#UserCountryId')->event('change',
        $this->Js->request(array(
                'controller'=>'states',
                'action'=>'ajax_list'
                ), array(
                'update'=>'#UserStateId',
                'async' => true,
                'method' => 'post',
                'dataExpression'=>true,
                'data'=> $this->Js->serializeForm(array(
                        'isForm' => true,
                        'inline' => true
                        ))

                ))
        );

?>

app/Controller/StatesController.php
Contains

/**
 * ajax_list method
 *
 * @return void
 */
        public function ajax_list() {
                $this->State->recursive = 0;
                $country_id = $this->request->data['User']['country_id'];
                $ajaxFunctions = $this->AclFunction->find('list', array(
                        'conditions' => array('State.country_id' => $country_id)
                ));

                $this->set('ajaxFunctions', $ajaxFunctions);
                $this->layout = 'ajax';
                        }




On Wed, May 23, 2012 at 5:52 PM, Kennix <kehindeaded...@gmail.com> wrote:

> I need a tutotial on how to implement chain select with CakePHP
>
> example, on selecting a Country from Countries drop down option, the
> State in the selected should populated
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

Reply via email to