XF 2.2 Error type message in modal/overlay instead of just flashing

Dannymh

Active member
Hi all,

Back again with possibly a moronic question.

I am doing a bunch of things in a controller after the entity has done its things. Basic process is

User fills in form and submits >> Entity saves the information after doing a few pre and post things >> Controller does some pre-load decision making based on data. Some of those things are fine to have the flash message and redirect functionality, however other things are more important for users to see. So I want to pop this up in a modal that they dismiss and then the page is redirected after that.

I can do those more important things inside the entity to a degree and $this->error('my important note') however that will also not do the redirect afterwards

is there an inbuilt way to instead have the controller logic pop up a modal message and then redirect after they click on the X or ok or whatever?
 
If you return a view regular view instead of a redirect, it should pop up in an overlay. There's no built-in way to redirect somewhere when closing the overlay, but you can present whatever interface you like, including buttons which link to wherever.
 
If you return a view regular view instead of a redirect, it should pop up in an overlay. There's no built-in way to redirect somewhere when closing the overlay, but you can present whatever interface you like, including buttons which link to wherever.
I am trying to wrap my head around how I would use a view instead here.

Essentially I have built a macro that slots into the thread that allows the form to do its thing. Once that thing is done, I redirect back to the thread because that handles all the display and loading of what I need rather than just returning the threadview.

I guess instead I could consider rewriting the code to be more of an Ajax form so it only loads that macro inside the page and that would eliminate everything else, I could also probably also move the logic to the entity instead of the controller too
 
I presumed you were using <xf:form ajax="true"> already? When AJAX form submissions return a non-redirect response, they should automatically pop open an overlay. In a hand-wavy sense, that's how $this->error(...) works already (it renders the error template).
 
Top Bottom