开发者

CakePHP - Automatically populate form fields from model

开发者 https://www.devze.com 2023-03-23 13:38 出处:网络
I thought the form helper did this already, but can the fields in my form automatically be popu开发者_运维技巧lated with values from the model or do I have to set them all as template variables and se

I thought the form helper did this already, but can the fields in my form automatically be popu开发者_运维技巧lated with values from the model or do I have to set them all as template variables and set them all as the value of each field manually?

The form is for a user profile, so I just want it to put the user's names, email, etc in the correct form fields automatically.


for example: in controller $this->data = $this->Model->find('first',array(...));

in view:

$this->Form->create('Model');
 $this->Form->input('field1');
...
$this->Form->end('Save');
0

精彩评论

暂无评论...
验证码 换一张
取 消