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

Having weird issue with AJAX processing...

Discussion in 'XenForo Development Discussions' started by Jaxel, Jun 3, 2012.

  1. Jaxel

    Jaxel Well-Known Member

    I have a form:
    Code:
    <form action="{xen:link 'rankings/result/edit', $result}" method="post" class="xenForm formOverlay AutoValidator" id="ResultPoster">
    As you can see, it is a formOverlay created through "OverlayTrigger". In addition to that,AutoValidates and I am registering it through AJAX using "ResultPoster".
    Code:
    /** @param {jQuery} $ jQuery Object */
    !function($, window, document, _undefined)
    {
        XenForo.ResultPoster = function($form)
        {
            $form.bind('AutoValidationComplete', function(e)
            {
                if (e.ajaxData.templateHtml)
                {
                    new XenForo.ExtLoader(e.ajaxData, function()
                    {
                        $(e.ajaxData.templateHtml).xfInsert('replaceAll', '#eventResults', 'xfShow');
                    });
                }
            });
        }
     
        // *********************************************************************
     
        XenForo.register('#ResultPoster', 'XenForo.ResultPoster');
    }
    (jQuery, this, document);
    Its basically the simplest AJAX you can do... when the form successfully validates, it replaces #eventResults with the returned response templateHtml. This is all working correctly. The problem comes with the actual script.

    Using the following works:
    Code:
    if ($this->_noRedirect())
    {
        return $this->responseView('EWRtorneo_ViewPublic_EventResults', 'EWRtorneo_EventResults', $viewParams);
    }
    However, if I use a responseRedirect instead of a responseView, it doesnt work... templateHtml is always undefined.
    Code:
    if ($this->_noRedirect())
    {
        return $this->responseReroute('EWRtorneo_ControllerPublic_Rankings_Event', 'Results');
    }
    Is there a reason for this? How do I fix?
     
  2. Jaxel

    Jaxel Well-Known Member

    Ah.. I figured it out... when using AJAX, you dont have access to the same XenForo_Input.
     

Share This Page