开发者

fill custom form with object

i have a simple form: UserInfoForm(). when i first display the form to the user, i want it to be filled with data from a specific object of the User model. can anyone give 开发者_StackOverflowme a direction or an example? thanks!


Normally, you'd do it like this but it depends on how your UserInfoForm relates to the User object:

$user = Doctrine::getTable('User')->findOneById($user_id);
$this->form = new UserInfoForm($user);

Edit: I'm assuming you're using Doctrine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜