In grails, I use the following mechanism to implement what I would call a server-side conditional dialog. When the form is submitted, the data must first be processed by the controller. Based on the results, there should be either: a) modal confirmation Yes / No in front of the "old" screen or b) redirection to a new controller / view, replacing the "old" screen (confirmation is not required).
So here is my current approach:
- In the original view, I have
<g:formRemote name="requestForm" url="[controller:'test', action:'testRequest']", update:"dummyRegion">and <span id="dummyRegion">that are hidden CSS - When submitting the form, the control controller checks whether confirmation is required, and if so, displays the template using a yue-oriented dialog, including Yes No buttons in front of the old screen (which works fine because the dialog "occurs" "dummyRegion, rather than rewriting the page) When the “Yes” button is pressed, the right other controller and action are called, and the old screen is replaced, if “No” is pressed, the dialogue is canceled, and the “old" screen is displayed again without dialogue. It works well so far.
- When submitting the form and the test controller, it is clear that the confirmation is NOT required, I usually redirect directly to another controller and action. But the problem is that the corresponding representation of this controller does not appear, because it is displayed in an invisible dummy. Therefore, I am currently using a GSP template that includes javascript redirection, which I execute instead. However, javascript redirects are often not allowed by the browser, and I think this is not a clean solution.
So (finally ;-) my question is: how do I get the controller redirection to make the corresponding view “break out” of my DummyRegion AJAX, replacing the entire screen again?
: , ? , , , ! , ( AJAX).
!