I hope the title does not sound too confusing, but I had no idea how to name my problem.
Brief intro:
I'm using Zend 1.1X.
At the moment I've been working with a search form sending few parameters via POST.
Now I have to change it to use GET, I have a route created looking similar to that:
"search/what/:what/shape/:shape"
and so on, I also have 2 optional parameters which takes null as default.
I'm trying to generate an URL (using Zend View Helper Url) at form's action, but it throws an exception:
Uncaught exception 'Zend_Controller_Router_Exception' with message what is not specified
I Now don't have idea what should I do. If I change my route to "search" only, it then sends the form correctly, but I end up with "search?what=XXXX&shape=YYYY"
instead of "search/what/XXXX/shape/YYYY"
.
Is there any way that could be handled the way I like??? :>
@EDIT
I think this should also be mentioned - I have a different form, similar one, pointing to a route without parameters specified as well and the uri gets "translated" to the form of "key/value" pairs. The only difference between them is that the first one does not use Url helper, instead has the method part hard-coded and my form is being submitted programatically (button => jQuery stuff => submit). Would that make a difference here, as I believe it should not? :>
I hope any possible source of this behaviour will come up to you, because I'm really stuck at the moment and I simply can't find what's wrong..
Thanks in advance!
With the
GET
method a form generates an url like this:action?param1=val1¶m2=val2&....
I see two solutions:The first is to regenerate the URL by javacsript, we can imagine something like this:
But I don't think this is a good solution.
The second is to manage it with a plugin:
For the plugin, it must be declared in the
bootstrap
.For example:
with this example, the
application/plugins
folder, create thePRoutage.php
plugin like this:and with the variable
$request
you have access to your data as an array with$request->getParams()
.We can imagine something like this:
I hope it will help you