Hi Aaron,
Thank you for your answer. Here the more detailled workflow:
1. User goes to page A.
2. User clicks there on an element which submits the HTML
form and should show i.e. page B later (there are a
lot of possible things the user can do on page A which
submit the form and forwards the user to different pages).
3. Server executes the associated action method on the
PageAComponent.
4. Action method calls validateSomeThings().
5a. If validateSomeThings() returns true, the action
method will return i.e. page B as ActionResults.
5b. If validateSomeThings() returns false, the action
method will set a condition and returns page A again.
6. Because of the condition, the warning dialog (with two
buttons) will be shown on page A (as an overlay div).
7a. If the user clicks on "cancel" within the warning dialog,
a further action method on PageAComponent will be called.
It sets the condition back to false and returns
PageAComponent again as ActionResults.
7b. If the user clicks on "proceed" within the warning dialog,
a further action method on PageAComponent will be called.
It fixes the validation problem, sets the condition back
to false and should return i.e. PageBComponent.
The problem is, that I don't know, which action method has been called
on (3) and which will be the next page, that should be shown on (7b).
Therefore I try to replay the initial request from (2) on (7b) to
simulate the initial action of the user.
I can return PageAComponent on (7b) only, but then the user must repeat
his action on page A (which will not show the warning dialog this time).
But this is ugly.
The question is, how I can solve that?
Thanks!
André
Am 11.11.2023 01:46, schrieb Aaron Rosenzweig:
Hi André,
I didn’t fully understand but it sounds like maybe you are working too
hard. It’s easier to hold onto WOComponents than it is to hold onto
contexts. If you have an “old page” hold onto it and just return the
page. If you don’t have the outermost page you can find that quickly
by doing “context().page()”
Hope that helps,
— Aaron
On Nov 10, 2023, at 3:09 AM, André Rothe via Webobjects-dev
<webobjects-dev@lists.apple.com> wrote:
Hi,
I try to replay an old WORequest after some other
request/response-loops, but I don't know, how it could work.
My application validates some values after the user clickes somewhere
on a page. In the validation routine I don't know, which action the
user has executed exactly. But the validation can be wrong, so I
display another page (an overlay dialog over the current page), where
the user can decide between "Cancel" and "Proceed". On "Cancel" I
return the current page without the overlay, on "Proceed" I fix the
problem in the validation and now I can go back to the current page
too, but the user has to execute his action again.
Can I automatically execute the previous request? I can store the
context-Id of the source page (before overlay) like:
String oldCtxId = context().contextId();
WORequest oldReq = context().request();
and after the data fixes (user has clicked on "Proceed", WO calls the
associated action like proceedChangeAction() on my page component) I
could restore the source page from the cache:
WOComponent oldPage = session().restorePageForContextID(oldCtxId);
And now I could send the "oldReq" to the component "oldPage". How can
I do that, to solve the problem?
Thanks a lot
André
_______________________________________________
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/aaron%40chatnbike.com
This email sent to aa...@chatnbike.com
_______________________________________________
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