views:

48

answers:

2

I'm quite newbie in CakePHP, I've tried to create a form with form helper on a date field

echo $this->Form->input('Item.date');

yes, works fine (I'm using CakePHP v1.3.3) for input/add new record but when I try using it on edit page it does nothing. here's the code

echo $this->Form->input('Item.date', array("value"=>$rs['Item']['date']));

it still display listbox without retrieving the value from desired table. Any help appreciated, sorry for my english..

A: 

I've found the answer, using selected option:

echo $this->Form->input('Item.date', array('selected'=>$rs['Item']['date']));
userbiasa
A: 

you shouldnt use inline params for default values. pass them down from the controller:

http://www.dereuromark.de/2010/06/23/working-with-forms/

see "default-values"

mark