Hi Gareth,
The normal ->forward or ->redirect methods will not work because they are
sent within the HTTP header of the response and prototype will not follow
such a redirect. But threre are other possibilities to break out of a div.
You can use javascript to do a redirect for example. In your remote
function, you have to enable scripts and within your response you can write
something like
<?= javascript_tag('window.location = "'.url_for('@page').'";' ?>
which should work in most browsers. In some browsers it won't work. In that
case, you can put your JS redirect in a function:
<?= javascript_tag('
myredirectfunction = function(){
window.location = "'.url_for('@page').'";
}
' ?>
and call that function in the onComplete handler of your remote function (in
the options: 'complete'=>'myredirectfunction()'). If you do not want to
redirect (i.e. wrong login data), just leave the function empty.
Carsten
On Wed, Mar 18, 2009 at 12:06 PM, Gareth McCumskey <[email protected]>wrote:
> If I might just add. My thinking has been looking at finding someway either
> in the AJAX helper itself to pass some kind of setting to make the result
> load "over" the current page or some way in the action that the "url"
> parameter references to force it reload the view and "break out" of the div
> tag. I have used $this->redirect , $this->forward and no luck.
>
> Would love to hear someone else take and I can't see that this is a unique
> problem.
>
> Gareth
>
>
> On Wed, Mar 18, 2009 at 12:39 PM, Gareth McCumskey
> <[email protected]>wrote:
>
>> Let me clarify the rather odd title of this message using an example. Lets
>> say you have created an application that uses AJAX to load content into
>> div's using the link_to_remote function as well as a number of others. A
>> user log's into the application (i.e. is authenticated) and uses the system
>> with no problem. This user then does not log out explicitly and steps away
>> for a while, lets say to lunch, leaving his browser open. When he returns he
>> clicks on a link in the app created by link_to_remote and instead of getting
>> what he expects to load into the div, he gets a login form. Ideally what
>> should have happened was that when the authentication filter detected that
>> his session timed out (i.e. not authenticated anymore), it loads the login
>> form over the entire page and not just the div that was supposed to be
>> logged into.
>>
>> My question is, does anyone know anyway to set an action (like our
>> users/login) to break out of all div's they may be in and to reload the
>> entire page?
>>
>> Gareth
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---