Connecting elements via Ajax

"Sean P. DeNigris" <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
I'd like to have a range slider and text input that work together to pick a
date. I came up with the following:

renderContentOn: html
	| slider textFieldID textField sliderID |
	textFieldID := html nextId.
	sliderID := html nextId.
	slider := html rangeInput
		id: sliderID;
		min: '1/1/2018' asDate julianDayNumber;
		max: '12/1/2018' asDate julianDayNumber;
		value: 1;
		onInput: (html jQuery ajax
			callback: [ :sliderValue | currentValue := Date julianDayNumber:
sliderValue asNumber. "5 seconds asDelay wait" ] value: html jQuery this
value;
			script: [ :s | s << (s jQuery id: textFieldID) value: currentValue
mmddyyyy ]);
		yourself. 
	textField := html textInput
		id: textFieldID;
		yourself.

Does this look like a good approach? Any other recommendations?
Specifically, I was wondering if `callback:value:` was guaranteed to be
processed before `script:`. I suspected it might be since `script:`'s
comment says it's the "main callback". I also uncommented the delay above
which appeared to confirm the order I expected, but maybe I just got lucky!!



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Seaside-General-f86180.html
_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.