-- Laurens van Vliet <[email protected]> wrote
(on Wednesday, 31 August 2011, 10:21 AM +0200):
> I have a problem with processing a form when a slash is submitted.
> The form has a Zend_Form_Element_Text where a slash can be submitted.
> (name of the field is code)
> The method I use for the form is POST en the encType for the form is
> Zend_Form::ENCTYPE_URLENCODED
>
> When the form is posted with for example code = 'a23/ef' to my
> controller/action. The url becomes ../controller/action/code/a23/ef
> and my controller can't recognize the code, because it is only reading
> the first part 'a23' and not the rest '/ef'.
> What I want to have is: ../controller/action?code=a23%2Fef , that way
> I can read the whole code.
I'm not sure how this is possible, to be honest, unless you're talking
about a URL generated _after_ form submission, within your application.
First, to get the submitted form parameters in the URI at all, you have
to be using GET, not POST. Second, GET form parameters are always
passed via a query string (the part folling "?" in the URI) -- they are
never appended as part of the path (the part following the hostname, up
to the "?", if any is present).
So, it sounds like perhaps on a failed submission, you're generating a
URL for the form, and it's getting injected with already submitted
parameters. If this is the case, the solution is pretty easy: explicitly
pass the options, route name, and the reset parameters to the url()
helper. If you're using the default route, the easy way is:
echo $this->url(array(), 'default', false);
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]