Hi all..
I've got a question for you all that I'm not sure how to handle in Seaside.. If I've got a page that comes up with a bunch of links at the top (a link menu of sorts to point to other object/pages) and a form for updating contact info for the user below that, and if the user is updating their contact info (using a Proxy -- WAModelProxy -- to update the underlying object with their data in it)... But before they finish and hit the submit button, they hit one of the links at the top of the page.. Now, in this case, I want to clear out the contents from the Proxy to ensure whatever crap they put into the fields is discarded and effectively reverts back to the committed "real" object contents. However, since they're not hitting the submit button, I can't use its callback.. I suppose I could have each possible link on the linkbar check to see if there was unfinished "work' and to clean it up, but since that unfinished "work" was in a different object, it might be tricky.. Are there any other means by which I can effectively gain control by the "outgoing" (for lack of a better term) object but before the incoming object gets its rendering method going? Ideally, it would be nice if I could register a callback with something like : (html leavePage) callback: [...] to have that code called before the user leaves the page behind.. Perhaps some sort of means exists to do such a task or am I out in left field somewhere? Thanks! -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Rick Flower wrote:
> Hi all.. > > I've got a question for you all that I'm not sure how to handle in > Seaside.. Nevermind.. Solved my problem.. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Pray, tell us how! This is an issue I'm sure to run into as well.
Dan On Jul 27, 2006, at 12:12 PM, Rick Flower wrote: > Rick Flower wrote: >> Hi all.. >> I've got a question for you all that I'm not sure how to handle in >> Seaside.. > > Nevermind.. Solved my problem.. > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Dan Shafer wrote:
> Pray, tell us how! This is an issue I'm sure to run into as well. Dan.. In my particular case, with code that was posted to this list back in Feb/March of this year (look for threads with my name in them), my top level application class has the concept of the "currentWidget" and to solve this problem, I added a "lastWidget" object as well. The currentWidget always refers to the page about to be painted (think of that as the newly selected page), and the "lastWidget" was the last page to be painted (about to go out of scope if you will). Using this concept and having all of my widgets inherit from a (mostly) empty base class called MSWBase, I've got the following that all widgets inherit (and can override if needed): MSWBase>>abortOperation "Abort any existing operation going on if the user decides to render a different object (e.g. visit a different page)" "In this case, you should override this in any derived classes to do what you need." While this does nothing for most objects, any object that does need it can easily override it such as in my contact page widget, which looks like the following : MSWContact>>abortOperation "Abort any existing operation going on if the user decides to render a different object (e.g. visit a different page)" validationDict keysDo: [:key | validationDict removeKey: key]. (self userProxy) rollBack. In this case, I'm rolling back my proxy to forget any modifications made to my proxy object -- I've got a modified version of WAModelProxy I'm using (thanks to Martin Laubach for the suggestion and code hints), and ditching any validation errors from my validation dictionary (filled in by my form validator). Anyway, got a bit off track there.. Let's see.. In my menu class (MSWMenu), I've got code like the following: html listItem with: [ html anchor callback: [ (parent lastWidget) abortOperation. self contactWidget ]; text: 'Update Contact Info' ] If you do this for every link in your menu, then each widget has a chance to do any sort of aborting needed to cleanup whatever it was doing. In this case, if the user was in the contact page and pressed the contact page link again, all of his changes would be tossed out as part of the abortOperation method call above. Hope this helps (and more importantly makes sense!).. -- Rick _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |