Mailing List webobjects-dev@wocommunity.org Message #488
From: Markus Ruggiero (rucotec) <markus.ruggiero@rucotec.ch>
Subject: Problems with chaining AjaxModalDialogs (opening a modal dialog from within a modal dialog)
Date: Tue, 23 Jan 2024 17:37:50 +0100
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Signed Data (Text SHA256)
<tl;dr>
My question is how can I have a modal dialog on a page containing a link to open yet another modal dialog for gathering and submitting data. 

<long version>

On a page there is a nice AjaxModalDialog working fine.
Inside this modal dialog I have just display stuff, some navigation links, and one AjaxModalDialogOpener.

Idea is that the at some point the user clicks and gets the first display dialog with the nav links. All navigation actions on this dialog use redirects to transfer control to another page, but one particular action does not warrant its own full page. Thus I want to show a second AjaxModalDialog for the user to enter some data. Inside this second dialog there are some WOStrings, one WOText and an OK and a Cancel button (WOSubmitButton). The WOText and the WOSubmitButtons are properly embedded inside a WOForm. The dialog code itself resides outside of any form on the main page component (no nesting). In any case after Ok or Cancel the second modal dialog should be closed and the user returned to the base page (that means also the first dialog with the navigation links is closed and gone).

Without action binding on the AjaxModelDialogOpener for the second dialog I do get the second dialog but it is shown in a position in the browser window relative to the first dialog overlaying it from its top left corner and extending downwards and to the right (the second dialog is larger than the first one). This looks ugly.

Adding an action binding to the dialog opener for the second dialog with only the following 2 lines of Java code

public WOComponent openCommentsDialog() {

AjaxModalDialog.close(context());

AjaxModalDialog.open(context(), "commentsID");

return null;

}


...does weird things. The outer dialog is closed then the second dialog is opened. Ok so far, looks good, dialog is properly placed. Getters for the WOStrings are triggered and data is displayed. However there is no form submission when the submit button is clicked. The dialog is closed, the underlying first dialog is also gone but no data is sent and the save() method bound to the submit button is not triggered. It looks like the submit request is sent but goes into some kind of nirvana.

Without this action method on the opener the data IS properly submitted but the layout, man that’s ugly (see above)

What can I do? Why is the submit request getting lost?

---markus---



Content Unaltered as verified By:
<markus.ruggiero@rucotec.ch>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster