[Seaside] JQuery UI slider updates textfied and textfield updates slider: how to?

Julian Fitzell jfitzell at gmail.com
Sat Aug 28 22:31:43 UTC 2010


On Sat, Aug 28, 2010 at 6:43 PM, Lawson English <lenglish5 at cox.net> wrote:
>  On 8/27/10 3:19 AM, Lukas Renggli wrote:
>>>
>>> >  MyTestSlider>>renderContentOn: html
>>> >      self renderExplanationOn: html.
>>> >  html form: [
>>> >            html text: 'slider value here: '.
>>> >        html textInput
>>> >           value: self current;
>>> >      callback: [ :value | self current: value ].
>>> >     html div script: (html jQuery new slider
>>> >        value: self current;
>>> >        onStop: (html jQuery ajax
>>> >    callback: [ :value | self current: value asNumber ]
>>> >  value: (html jQuery this slider getValue))
>>
>> Try to add something along the following lines to your onStop: event:
>>
>>    , ((html jQuery id: 'id-of-your-textfield) value: html jQuery this
>> slider getValue)
>
>
> I'm not quite getting the syntax. Not sure how the line you gave me fits in
> with the rest (or what it does, for that matter).
>
>
> Usually I can play with the syntax until the compiler accepts it, then I can
> try to figure out WHY the compiler accepts it.
>
> Can't get the compiler to accept an addition/modification along the lines
> you suggest, and I'm not good enough with smalltalk to just "read it" and
> tell what needs to go where.

The added code generates JS that gets the text field by id ("html
jQuery id: 'id-of-your-textfield'") and sets its value ("value:") to
the value of the slider ("html jQuery this slider getValue"). Lukas is
suggesting that you need to this as well as sending the value back to
the smalltalk image. You can combine two JS actions using a comma so:

html div script:
   (html jQuery new slider
      value: self current;
      onStop:
         (html jQuery ajax
            callback: [ :value | self current: value asNumber ]
            value: (html jQuery this slider getValue)) ,
         ((html jQuery id: 'id-of-your-textfield)
            value: html jQuery this slider getValue))

Julian


More information about the seaside mailing list