-- AmirBehzad Eslami <[EMAIL PROTECTED]> wrote
(on Tuesday, 01 April 2008, 09:09 AM +0330):
> Dear list,
>
> Is it possible to redirect to a different URL if the form is invalid?
> The new URL should contain the submitted form with the
> user-provided values and error-messages.
> I tried the following code, but it failed; the displayed form is fresh.
>
> if (!$form->isValid($this->getRequest()->getPost())) {
> // Failed validation; redisplay form
> $this->_helper->_redirector->setCode(303)
> ->setExit(true)
> ->setGoto('#error-msg');
> return;
> }
>
> How can keep the form's data and its state
> after the redirection (without using Sessions)?
You could cache it, but without a session identifier, how will you know
you have the correct cache on the subsequent request (and not somebody
else's)?
Use a session.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/