[Seaside] JQuery updating DOM elements
siguctua at gmail.com
Tue Feb 10 21:15:38 UTC 2009
Its easy to mistake putting an html into #onChange: method.
It is also confusing to read, because you seeing both, html rendering
source, and callback script/ajax rendering in the same method body ,
and its easy to make a mistake and mix contexts.
Maybe it worth considering about adding a different form of it?
html ajax on: #change send: #onMyDivChangeCallback: to: self
so, then in onMyDivChangeCallback: you can provide html rendering for
ajax request, and you can't use different html canvas other than
passed to this method. Safe & clean.
2009/2/10 John Toohey <johnptoohey at gmail.com>:
> - How do I use Slime with my Code? Using the latest Pharo image, and have
> found the Slime classes, but not sure how to use them.
> - Tried this :-
> html span class: 'formdata'; with: [html
> id: #tournamentname;
> value: tournamentEvent tournamentName;
> callback: [:value | tournamentEvent tournamentName: value];
> onChange: (html jQuery ajax serializeThis; html: [:r | r render: [self test:
> 1 on: r]] )].
> but cannot see any changes to the DOM element.
> Thanks for looking at this for me.
> On Tue, Feb 10, 2009 at 3:18 PM, Lukas Renggli <renggli at gmail.com> wrote:
>> > html span class: 'formdata'; with: [html
>> > textInput
>> > id: #tournamentname;
>> > value: tournamentEvent tournamentName;
>> > callback: [:value | tournamentEvent tournamentName: value. self test:
>> > value
>> > on: html];
>> > onChange: (html jQuery ajax serializeThis)].
>> html is not valid in the context of a callback. When the callback is
>> evaluated the response connected to the html canvas you are referring
>> to has already been sent to the client. Slime would detect such
>> > #potsize is the id: of another field in the dialog. My callback works,
>> > but
>> > the DOM is not updated. What is the correct way to update other DOM
>> > elements
>> > in this fashion?
>> Try something along:
>> onChange: (html jQuery ajax
>> html: [ :r |
>> " gee, we have a new renderer "
>> r render: DateAndTime now ])
>> Lukas Renggli
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
> seaside mailing list
> seaside at lists.squeakfoundation.org
Igor Stasenko AKA sig.
More information about the seaside