Reputation: 127
I'm in the middle of configure()
method and I must set a default selected value for a combobox. The value is in the URL, but no request or any object.
How to reach this variable?
Upvotes: 0
Views: 691
Reputation: 1696
Not a good idea to use sfContext
in that context.
Better send the parameter in the constructor of the form. Something like this:
$form = new Form(array(), array(‘my_form_param’ => $request->getParameter('my_get_param'));
In the form you can call it with:
$this->getOption('my_form_param')
Upvotes: 4
Reputation: 55271
You can access the request from anywhere like this:
sfContext::getInstance()->getRequest()->getParameter('foo')
Upvotes: 1