[Seaside] Connecting elements via Ajax

Sean P. DeNigris sean at clipperadams.com
Fri Sep 7 17:40:48 UTC 2018


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


More information about the seaside mailing list