FlashMessenger is meant for displaying messages only after receiving a
second request, like a redirect:

FIRST REQUEST
Client to Server - POST form values
Server - Process form values
Server - Form values will cause a redirect, record all messages FlashMessenger
Server to Client - Send redirect

SECOND REQUEST
Client to Server - GET redirect page
Server - Check FlashMessenger queue for messages
Server to Client - Print out messages

In order to solve your problem, record messages to an internal message
queue (say an array on Zend_Registry) when you aren't redirecting,
otherwise use FlashMessenger.

- jake

On Tue, Jun 3, 2008 at 10:11 AM, Jeffrey Sambells
<[EMAIL PROTECTED]> wrote:
> I think the issue is around adding to the flash messenger and then
> retrieving the message at the end of the same request (no refresh). I'm
> having a similar issue where we use the flash messenger to store messages
> and then try to retrieve them during the same request. Sometimes the
> application needs to re-direct and sometimes not so the flash messenger
> seemed the appropriate place to store them but often they don't show up
> until the following page load. I haven't had time to loot into it though.
>
> - Jeff
>
>
> On 3-Jun-08, at 9:56 AM, Bart McLeod wrote:
>
>> If you submit the form and validate it, your post data will still be in
>> the form, while the page has been refreshed (there has been a round trip to
>> the server upon form submission).
>>
>> I did never use flashmessenger, but I do not see why it would not display
>> its message when the user submits the form and thus refreshes the page?
>>
>> Bart
>>
>> Vincent schreef:
>>>
>>> Hi,
>>>
>>> In my project, the user now and then has to submit a form. Sometimes,
>>> there is an error with processing this form (e.g. the data couldn't be
>>> inserted into the database).
>>>
>>> To communicate this to the user, I use the FlashMessenger action helper.
>>> However, the FlashMessenger won't display its messages until the next page
>>> load, which means I'll either have to refresh the page and lose the POST
>>> data, or preserve the POST data so I can populate the form with whatever the
>>> user just submitted, but lose the error message.
>>>
>>> What would be the recommended way to have both?
>>>
>>> Thanks,
>>> --
>>> Vincent
>
>

Reply via email to