Hey I am trying to get the selected option value in my route (annotation). I have Portfolio Controller which contains Index view. Inside the index view there is a form with only one select drop down. Initially the URL looks like
http://localhost/idp/web/app_dev.php/portfolio/
The form inside the index view is
<form name="portfolios" action="{{ path('v2_pm_portfolio_switch') }}" method="post" >
<select name="portfolio" style="width: 200px; height:25px;">
<option selected="selected" value="default">Switch Your Portfolio</option>
{% for portfolio in portfolios %}
<option value={{ portfolio.id }}>{{ portfolio.portfolioName }}</option>
{% endfor %}
</select>
<input type="submit"class="portfolio_input button2 tooltip" value="Switch">
</form>
When the user submit the form, it calls the switchportfolio
Action (inside portfolio controller)
My switch portfolio Action is
/**
* Switch Portfolio action.
* @Route("/{user selected option name should come here}", name="v2_pm_portfolio_switch")
* @Secure(roles="ROLE_Normal_Registered_User")
* @Template("MunichInnovationGroupPatentBundle:Portfolio:index.html.twig")
*/
public function switchportfolioAction(Request $request){
}
How can I send the selected option name to my URL in Symfony2 ? So that, if the user select portofolio1, and submit the form the URL becomes :
http://localhost/idp/web/app_dev.php/portfolio/portfolio1