Connecting elements via Ajax

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Connecting elements via Ajax

Sean P. DeNigris
Administrator
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Cheers,
Sean