> Hi.
>
> I have class which extends Zend_Form. What I want to do during elements
> initialization is to assign default values to elements from the request. But
> I cant reach getParam method from the form. Is there some elegant way to do
> this (without passing all values to form constructor)?
In your controller where you initiate your form you can call the
populate() method, e.g.
public function IndexAction()
{
$request = $this->getRequest();
$form = new MyForm();
// $request->getParam('name');
// Sanitise params and assign them to array $values[]
$form->populate($values);
没有评论:
发表评论