1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Having an issue with responseRedirect

Discussion in 'XenForo Development Discussions' started by robdog, Aug 16, 2011.

  1. robdog

    robdog Well-Known Member

            return $this->responseRedirect(
                new XenForo_Phrase('successfully_joined_our_mailing_list'));
    I can get the redirect to work but I thought there would be a dialog that would display while the redirect is taking place with the phrase "successfully_joined_our_mailing_list".

    Or should I use something different than responseRedirect?

  2. Kier

    Kier XenForo Developer Staff Member

    By default, responseRedirect uses a silent redirect with no message. If you call it via an action that is loaded with AJAX, such as <form class="AutoValidator">, the message will be displayed in a sliding panel at the top of the page, as you see when you save your profile info.
  3. DarkSign

    DarkSign Active Member

    I am having a problem with responseRedirect as well. In my case, the redirection is NOT occuring :(

    I am using the AutoValidator class, so my form is being posted using AJAX, but even if I take the AutoValidator off, that is not working. My redirection return is just

    $return XenForo_Link::buildPublicLink('threads'$thread);
    The idea is, since the form is posted using ajax, to cause a reload of the thread being viewed. Because the limit was applied, the 'Set thread limit' block won't show again, otherwise, the value can be changed as much as you want, before you actually reload the page...

    What am I doing wrong?
  4. Onimua

    Onimua Well-Known Member

    Have you added data-redirect="on" to the form? I've come across this as well and adding that with the AutoValidator class to the form makes it work as expected.
    Uniphix and DarkSign like this.
  5. DarkSign

    DarkSign Active Member

    That was it! Thank you very much, Onimua! The better way would be to return another template, using AJAX, but as I am learning things, to redirect makes my custom template to be hidden due to my restrictions, so thank you so much! It worked :D
  6. Uniphix

    Uniphix Active Member

    Exactly what I was missing as well!

Share This Page