2009年3月9日星期一

Re: [fw-mvc] how to pass params to a Zend_Form construction

>
> Don't override the constructor, do it with init() instead. Take a look
> at the docs:
> http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.custom

Martin, init() wouldn't help because when init() is called, we need to have had the params
available already.

On a second thought, I think maybe this is good enough, although the code looks a little ugly

$form = new Form_Search();
$form->setMyParams($params);
$form->build();

and inside the Form_Search class, in stead of building the form inside the
init(), it should be built inside the build() function.

Cheers,
Hoang

没有评论: