Overlay Dialog That Responds With Redirect Message

digitalpoint

Well-known member
So I have an overlay message that pops up, and I have the result of it doing a regular redirect already. But is there a way to get it to give a message with the redirect like it does for various other actions (like starting a thread for example)?

I also see that the Controller responseRedirect() method has an optional parameter for the message, and obviously it needs to hook into JavaScript somewhere since that's where the redirect message is coming from... I just can't get the message to display. Is it not possible with forms from overlays, or?

Maybe I'm just missing a flag on the forum to convert it to an ajax request that will then read the message?
 
That handling is part of the AutoValidator form JS class (with the data-redirect attribute on the form tag).
 
Ah... I caught the data-redirect attribute, but I missed the AutoValidator... tyvm

Is it just as simple as setting the AutoValidator class on the form? Or is there some sort of form specific callback you need to set that I'm missing (forgive me, it's almost 2am)... :)
 
Also, just had a thought... since the overlay forms come in via an AJAX request, wouldn't that mean it's going to miss the register event for it?

Code:
XenForo.register('form.AutoValidator', 'XenForo.AutoValidator');

So maybe it's just not possible when it's an overlay form?
 
Also, just had a thought... since the overlay forms come in via an AJAX request, wouldn't that mean it's going to miss the register event for it?
No. :)

It is basically as simple as adding AutoValidator to the form. You should see it submit via ajax automatically then.
 
That did indeed trigger an AJAX event (as you know). Unfortunately it ended up barfing back PHP errors when the only change was the AutoValidator class addition... maybe something screwy with it being a post view combined with the json renderer...

Code:
An exception occurred: Undefined index: liked in /home/sites/dev.digitalpoint.com/web/xenforo/library/XenForo/ViewPublic/Post/LikeConfirmed.php on line 24

XenForo_Application::handlePhpError() in XenForo/ViewPublic/Post/LikeConfirmed.php at line 24
XenForo_ViewPublic_Post_LikeConfirmed->renderJson() in XenForo/ViewRenderer/Abstract.php at line 215
XenForo_ViewRenderer_Abstract->renderViewObject() in XenForo/ViewRenderer/Json.php at line 88
XenForo_ViewRenderer_Json->renderView() in XenForo/FrontController.php at line 533
XenForo_FrontController->renderView() in XenForo/FrontController.php at line 156
XenForo_FrontController->run() in /home/sites/dev.digitalpoint.com/web/xenforo/index.php at line 13

Much to late to be thinking about this... thank for sending me in the right direction... will muck with it tomorrow after some sleep.

Strange because what I'm doing has nothing to do with likes (although maybe that is the problem since it's expecting the like field by default or something).
 
it seems that you're returning the view via XenForo_ViewPublic_Post_LikeConfirmed
PHP:
return $this->responseView('XenForo_ViewPublic_Post_LikeConfirmed', ...
 
Yeah... already got it all squared away... was just coming back to post that (all working perfectly now).

Not sure why I had the class for the response view... probably just some left over copy/paste from when I was first figuring out the response views worked. It just happened to work before because it never dipped into that logic how I was doing it before with the straight redirect.

Okay, now I'm going to bed for real. :)
 
Top Bottom