Not sure if I properly wrote the subject but anyway.
Since you can create specific routes with different parameters for eg:
_search:
pattern: /page/{category}/{keyword}
defaults: { _controller: Bundle:Default:page, category: 9, keyword: null }
is there any way from a form with GET method to get to that route specific url format?
At the moment the url is like /page?category=2?keyword=some+keyword
As such is not passing to the route format as you may noticed.
What do I need to do to get it working through this specific format? I really have no idea how to rewrite the page url to match the route settings for the specific url. Even in plain php was stumbled on this ...
Thanks in advance.
I've too encountered this issue and I managed to resolve it with a slightly different solution.
You could also reroute like @Thomas Potaire suggested, but in the same controller, beginning your controller with :
You could add a second route that will just match /page
then in the controller you can get the defaults. and merge them with any that are passed.
Take a look at a similar question I answered for some code examples.
KendoUI Grid parameters sending to a symfony2 app
It's the default behavior of HTML forms with GET method. You will need to build that URL yourself.
Backend way
Your routing file
Your controller
Frontend way
Using Javascript, you can build the URL yourself and redirect the user afterwards.
Note: You will need to get your own query string getter you can find a Stackoverflow thread here, below I'll use
getQueryString
on the jQuery object.