[Seaside] JQuery load question
jtuchel at objektfabrik.de
jtuchel at objektfabrik.de
Mon May 19 13:16:09 UTC 2014
My snippet is at least syntactically correct with a closing bracket ;-)
(html jQuery ajax
script: [:s | myModel doSomething];
onComplete: [:s| s << ((s jQuery id: #foo) value: myModel
displayString])
One thing I may have overseen is that the question I am raising is
probably only relevant if #doSomething in has any influence on what
#displayString actually looks like. So as long as displayString is not
influenced by #doSomething, Johan's solution is perfect.
... or I am not understanding something, which is very well possible
Joachim
Am 19.05.14 15:12, schrieb jtuchel at objektfabrik.de:
> Hi Johan,
>
> your suggestion looks very similar to what I had in mind, apart from
> the fact that you don't use onComplete:. So I suggest there is
> something to learn in this for me. I thought I'd have to use (the
> deprecated) onComplete: block with the Ajax object just to make sure
> the ajax callback is finished before I update the input field. So
> using your code and my idea it would look more like this:
>
>
> (html jQuery ajax
> script: [:s | myModel doSomething];
> onComplete: [:s| s << ((s jQuery id: #foo) value: myModel
> displayString)
>
> (I just edited your code, there might be typos or errors in it).
>
> So I'd be interested in your thoughts on this since I am still a very
> early stage learner in this area....
>
> Joachim
>
>
> Am 19.05.14 15:06, schrieb Johan Brichau:
>> Hi Sven,
>>
>> In theory, you can still use load and render the entire input field
>> again.
>> But you are right that setting the value of the input field is a
>> better approach because replacing the entire field often messes with
>> the keyboard focus.
>>
>> What you need is a script callback:
>>
>> (html jQuery ajax script: [:s | myModel doSomething. s << ((s jQuery
>> id: #foo) value: myModel displayString)]
>>
>> I hope this is what you were looking for.
>>
>> Johan
>>
>> On 19 May 2014, at 14:59, Sven Van Caekenberghe <sven at stfx.eu> wrote:
>>
>>> Hi,
>>>
>>> I had some code that worked fine using JQuery's load functionality:
>>>
>>> html div id: #foo
>>>
>>> html button
>>> bePush;
>>> onClick: ((html jQuery id: #foo) load html: [ :h |
>>> myModel doSomething.
>>> h render: myModel displayString ]);
>>> with: 'Do Something'
>>>
>>> Now, I switched #foo to a form input:
>>>
>>> html textInput id: #foo
>>>
>>> But then I should use #value: and not replace the HTML so I can't
>>> use load anymore.
>>>
>>> I don't seem to be able to write this but I am a real beginner here.
>>> Anyone ?
>>>
>>> Thx,
>>>
>>> Sven
>>>
>>> PS: the data coming back is just a string, not HTML.
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel mailto:jtuchel at objektfabrik.de
Fliederweg 1 http://www.objektfabrik.de
D-71640 Ludwigsburg http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
More information about the seaside
mailing list