Hi
I haven't seen this question asked before; I apologize if it has. I'm trying to do something like this in seaside 2.9 html button onClick: (html jQuery ajax serialize: (html jQuery this); script: [:s | s << (s jQuery id: stratId) append: [html text: 'bing'. html break]]); callback: [2 inspect]; with: 'add option'. and as I expect my div with stratId is getting appended but I'm not getting an inspect window in my squeak image? What's the right way to do this? note that I also posted this question to stackoverflow at http://stackoverflow.com/questions/679607/why-isnt-my-serverside-callback-occuring-when-i-use-jquery-ajax-in-seaside-2-9 if someone wants to answer the question there. Might help push seaside out in public a bit. Many thanks, Steven H. Noble _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> I'm trying to do something like this in seaside 2.9
> > html button > onClick: (html jQuery ajax > serialize: (html jQuery this); > script: [:s | s << (s jQuery id: stratId) append: [html text: > 'bing'. html break]]); > callback: [2 inspect]; > with: 'add option'. > > and as I expect my div with stratId is getting appended but I'm not > getting an inspect window in my squeak image? What's the right way to > do this? The answer is in the second part of the method comment of #serializeThis: "Serialize the receiving element. Note that this might not work for all form elements: (1) for check-boxes and multi-select lists Seaside internally depends on an additional hidden form element that is generated automatically, instead use #serializeThisWithHidden (2) submit-button callbacks are ignored, instead use a normal callback to trigger specific code evaluation." Instead put your callback code into the jQuery callback itself (the #script: block). Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Wed, Mar 25, 2009 at 12:39 AM, Lukas Renggli <[hidden email]> wrote:
This is presumably because the form doesn't actually get submitted? Julian _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> This is presumably because the form doesn't actually get submitted?
#serializeThis serializes the element that triggered the event, in this case this "would" be the button. The reasons buttons don't serialize are indeed forms: If you serialize multiple inputs -- for example when you serialize a series of input fields or a complete form -- you most certainly don't want that a random button callback (e.g. add item, save, and cancel) is triggered (in fact, only the last one would actually be executed). That's why button callbacks are ignored and you are asked to perform your actions from within the callback of the AJAX element itself. It is only at that place where you know what action to perform. To put it simple: The original poster created a AJAX callback that was supposed to trigger a button callback. Instead of doing this unnecessary indirection why not simply call the button action from the AJAX callback? Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks Lukas,
That makes a lot of sense. Putting the code in the script block was my first instinct but I got thrown off by the name. Thanks again, Steven On Wed, Mar 25, 2009 at 1:30 AM, Lukas Renggli <[hidden email]> wrote: >> This is presumably because the form doesn't actually get submitted? > > #serializeThis serializes the element that triggered the event, in > this case this "would" be the button. > > The reasons buttons don't serialize are indeed forms: If you serialize > multiple inputs -- for example when you serialize a series of input > fields or a complete form -- you most certainly don't want that a > random button callback (e.g. add item, save, and cancel) is triggered > (in fact, only the last one would actually be executed). That's why > button callbacks are ignored and you are asked to perform your actions > from within the callback of the AJAX element itself. It is only at > that place where you know what action to perform. > > To put it simple: The original poster created a AJAX callback that was > supposed to trigger a button callback. Instead of doing this > unnecessary indirection why not simply call the button action from the > AJAX callback? > > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > 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 |
Free forum by Nabble | Edit this page |