request - Zend 2.x, setValue from url -
i want setvalue
in form class depending on get
request. set value in form sth :
class bookingform extends form { $this->add(array( 'name' => 'end', 'type' => 'text', 'options' => array( 'label' => 'date to', ), 'attributes' => array( 'value' => '2013-09-18 15:45', ), )); }
but it's hard coded , want avoid this, there method $this->getrequest()->get('var extracted url')
??
i founded solution in :
class bookingcontroller extends abstractactioncontroller { ... $get = $request->getquery('start'); $get = str_replace('_', ' ', $get); $form->get('start')->setvalue($get); ... }
and that's all.
Comments
Post a Comment