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.
精彩评论