Hey Stefan
You assumed correctly! Thanks for your great explanation and solution, everything works! At least for now.. Best regards, Dominik Huber rucotec consulting and technologies email mailto:dominik.hu...@rucotec.ch rucotec GmbH web http://www.rucotec.ch Steinenvorstadt 79 4051 Basel Mobile +41 79 298 07 40 Switzerland Phone/Fax +41 61 271 4990 > On 2 Sep 2020, at 13:13, Stefan Gärtner <stefan.gaert...@nureg.de> wrote: > > Hi Dominik, always nice to see someone new in the World of Wonders! > > I assume you have one action, which depending on business logic shall either > open an AjaxModalDialog or switch the page. > > It is important to understand that there are > normal WO actions (/wo/ inside the URL), which execute some logic and then > render a whole new page. > Either the previous one (method has returned null) > or a different one (method has returned pageWithName(MyPage.class)). > And there are Ajax actions (/ajax/ inside the URL), which execute some logic > and then return an (optional) HTML fragment to the browser, which will e.g. > be inserted into an AjaxUpdateContainer. > Usually you will return null in these actions. > Which AjaxUpdateContainer gets updated is usually controlled by bindings of > the component. > > Which of these two is used depends on the component calling the action. The > action methods look the same. > > WOSubmitButton will always execute a normal WO action. Therefore it can't > open an AjaxModalDialog, which is only suited for Ajax calls. > AjaxSubmitButton and CCSmartAjaxButton on the other hand will always execute > an Ajax action. Therefore they can't switch the page by simply returning > pageWithName(MyPage.class) > > Some background on AjaxModalDialog: If you're opening an AjaxModalDialog via > "AjaxModalDialog.open(context(), "id_my_dialog");" inside your method, the > generated HTML fragment only contains a Javascript call to open the dialog > (openAMD_my_dialog();). You can see this in your browser's developer tools. > > Fortunately there is a static helper function called AjaxUtils.redirectTo. It > can be used inside an Ajax action to change the page. So simply call > > AjaxUtils.redirectTo(pageWithName(MyPage.class)); > > inside of your method, use AjaxSubmitButton and you should be fine. > > The redirect then happens by returning a Javascript call like this: > document.location.href='/Apps/WebObjects/MyApp.woa/wo/52.0'; > > Cheers, > Stefan > > > >> Am 02.09.2020 um 10:53 schrieb Dominik Huber via Webobjects-dev >> <webobjects-dev@lists.apple.com <mailto:webobjects-dev@lists.apple.com>>: >> >> Hey guys, my name’s Dominik, I’m Markus Ruggiero’s new intern and I’ve been >> learning the Wonders for about 6 months now. >> >> I ran into a problem while working today and am still stuck so I figured I’d >> ask the WOrriors if ou have any insight you might be able to share with me. >> >> Here’s the situation: I’m working on a form which is validated twice. If any >> problem is found, a AjayModalDialog is opened to handle it. The second >> validation >> happens in my save method and that’s where I run into trouble. Because >> depending on which of the buttons(WOSubmitButton - AjaxSubmitButton - >> CCSmartButton) I use, either the ModalDialog isn’t opened or the last line >> of the code (return _homePage) isn’t run properly so the home page isn’t >> opened. >> >> Here’s the code: >> >> <PastedGraphic-7.png> >> >> Here’s what happens with which button: >> >> WOSubmitButton : Doesn’t open the Dialog, but is able to save if there’s no >> problem and return to the homepage. >> >> AjaxSubmitButton: Opens the Dialog, saves data but doesn’t return to the >> homepage. >> >> CCSmartAjaxButton: Opens the dialog, doesnt save data, doesn’t return. to >> home page. >> >> >> Does anyone have any experience with these problems or any idea where I >> could start looking? Markus and I have been looking for bindings to use but >> haven’t found any yet. >> >> Thanks in advance for your help! >> >> Best regards, >> >> >> Dominik Huber >> rucotec consulting and technologies email >> mailto:dominik.hu...@rucotec.ch <mailto:dominik.hu...@rucotec.ch> >> rucotec GmbH web http://www.rucotec.ch >> <http://www.rucotec.ch/> >> Steinenvorstadt 79 >> 4051 Basel Mobile +41 79 298 07 40 >> Switzerland Phone/Fax +41 61 271 4990 >> >> >> >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com >> <mailto:Webobjects-dev@lists.apple.com>) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/webobjects-dev/stefan.gaertner%40nureg.de >> >> <https://lists.apple.com/mailman/options/webobjects-dev/stefan.gaertner%40nureg.de> >> >> This email sent to stefan.gaert...@nureg.de > > > > -- > Mit freundlichen Grüßen > > Stefan Gärtner > /// IT/Software-Entwicklung /// > > NUREG GmbH /// > Dorfäckerstraße 31 | 90427 Nürnberg | Germany > Tel.: +49-911-32002-183 | Fax: +49-911-32002-299 > Nürnberg HRB 22653 | USt.ID DE 814 685 653 > Geschäftsführer: Michael Schmidt, Stefan Boas > www.nureg.de <http://www.nureg.de/> > > >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com