简体   繁体   中英

CakePHP form helper problem with date for editing

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..

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"

我使用选定的选项找到了答案:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM