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

How to reload page when submit a form by OverlayTrigger

Discussion in 'XenForo Development Discussions' started by starvnnet, Nov 7, 2013.

  1. starvnnet

    starvnnet Member

    Sorry for my bad english.
    I have a question:
    In my template, have a link with class="OverlayTrigger"
    Code:
    <a href="link_to_form" class="OverlayTrigger" ...
    My form
    Code:
    <form action="{xen:link 'starvnnet/save'}" method="post" class="xenForm formOverlay AutoValidator" data-redirect="on"> 
    My Controller
    Code:
    .....
    //$link = 'index.php';
    return $this->responseRedirect( XenForo_ControllerResponse_Redirect::SUCCESS,$link, new XenForo_Phrase('starvnnet_save_success'));
    
    Everything work well and when i submit my form, it will redirect to index.php
    Now i dont want to redirect to index.php. I want to reload only.

    Can you help me?
     
    Last edited: Nov 7, 2013
    laiminh77 likes this.
  2. Snog

    Snog Well-Known Member

    I hope you can understand this. Return to the route prefix for the page you want to reload. Be sure to set the viewParams.

    Code:
    return $this->responseView('Your_Mod_View', 'The_Route_Prefix_To_Return_To', $viewParams);
     
  3. starvnnet

    starvnnet Member

    @Snog Thank you, i will try to do it
     
  4. Snog

    Snog Well-Known Member

    Let's say the page you're on has a route prefix of yourapp-enter.

    Simply use the same route prefix to reload the page. So it would be

    Code:
    return $this->responseView('Your_Mod_View', 'yourapp-enter', $viewParams);
    There's no need to define the full URL.
     
  5. starvnnet

    starvnnet Member

    Hi, thanks for your help. I still use responseRedirect . And it works perfectly :D
    This is my code:

    Code:
    return $this->responseRedirect( XenForo_ControllerResponse_Redirect::SUCCESS,$this->getDynamicRedirect(), new XenForo_Phrase('
    starvnnet_save_success'));
    $this->getDynamicRedirect() is useful in my case.
     
    Last edited: Nov 7, 2013
    Chris D and Snog like this.

Share This Page