I have a dependent drop down
using jquery works fine

I found out today that i need to populate the name of the state in
another table instead of the id.

in my controller i use a simple find to populate the select box.

//controller

$states= $this->State->find('list',array
('fields'=>array('State.id','State.state')));

        $this->set(compact('states'));


in my view when someone picks the state it populates the city
then saves it to my users table state_id

//view

                <?php echo $this->Form-
>select('state_id',array($states),'state',array('id'=>'states'),false);
                ?><br /><br /><?php echo $this->Form-
>select('city_id',array('name'),'null',array('id'=>'cites'),false);?>


the problem i am facing is how can i save the state name instead of
the value ?


if i change my controller to this:

//controller

$states= $this->State->find('list',array
('fields'=>array('State.state','State.state')));

        $this->set(compact('states'));


It will save the form as i needed it, but my find will not work
because there is no id for the where clause.




i just need to save my option instead of my id and cant figure it out

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to