[Seaside] Re: Help with JQuery example
watchlala at hotmail.com
Mon Aug 27 22:51:02 UTC 2012
It looks like there's a few things you may or may not be doing with your code that I see. I don't necessarily have a solution for you, but maybe this will get you on the right track:
First of all, for your sanity, you may want to separate out your callback functions as separate methods. It makes the code a lot easier to follow.
Also, callbacks are simply functions that can be passed around just like a variable. They're known as anonymous functions also, if that helps. They are not overused in Seaside at all. In fact, many languages use them as a core aspect of their architecture (ie. NodeJS). Callbacks should be your best friend :) They are intrinsic to any asynchronous pattern (ie. Ajax). Here's a simple example:
I ask the server for something (ajax GET request).Now, I don't know when the server is going to get back to me with the answer, or if at all, but what I can provide is instructions for what to do with a successful or failed response.That's what the callback is doing for me.
I don't know much about Scriptaculous, but I think you probably want the ajax request object instead of updater. There should be a way to configure updater so that you serialize the form and send that data serverside.
Also, #renderTheListWith:on: doesn't need to do any rendering stuff. Your callback in the updater can deal with that.
> To: seaside at lists.squeakfoundation.org
> From: intrader at aol.com
> Date: Mon, 27 Aug 2012 22:06:24 +0000
> Subject: [Seaside] Re: Help with JQuery example
> intrader <intrader <at> aol.com> writes:
> Thanks both for your answers. The trouble I have is with callbacks
> in ajax calls (using scriptaculous) I include a pastebin of a small
> project superimposed on the code for MyFirstComponent. The paste is at
> http://paste.ubuntu.com/1170727/. I am not able to get the callback
> in the #onChange handler for the input text box. I am not clear what
> the #triggerForm method is for - it may have the effect of not
> allowing the callback in the onChange to execute.
> for seaside.
> Thanks for your help
> seaside mailing list
> seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside