Re: Is it possible to set the index of a select box after populating it with find('list')?

2009-05-05 Thread qwanta
Both 'selected'=> & 'default'=> seem to do the trick. Thanks! On May 5, 6:44 am, andy wrote: > Seehttp://book.cakephp.org/view/199/options-selected. In the view, > you will need to do something like this: > > $form->input('fieldname', array('options' => array($listvalue), > 'selected' => 'desire

Re: Is it possible to set the index of a select box after populating it with find('list')?

2009-05-05 Thread andy
See http://book.cakephp.org/view/199/options-selected. In the view, you will need to do something like this: $form->input('fieldname', array('options' => array($listvalue), 'selected' => 'desiredselectvalue') ); On May 4, 3:56 pm, qwanta wrote: > In the controller I do a find('list') to get an

Re: Is it possible to set the index of a select box after populating it with find('list')?

2009-05-05 Thread rich...@home
You can pre-populate the $this->data array: In your controller method: $this->data['Model']['field'] = 1; (where 1 is value you want to pre-select) or, in the view: input("field", array("options"=>$options, "default"=>1) ? > On May 4, 9:56 pm, qwanta wrote: > In the controller I do a find(

Is it possible to set the index of a select box after populating it with find('list')?

2009-05-04 Thread qwanta
In the controller I do a find('list') to get an array ready for populating a select box. I am quite stumped as to how I would set the selected index of the select box in the view. This is a case where the automagic situation (editing a record) is not applicable - it is a log entry form and a new r