[Seaside] #answer from within a jQuery

Lukas Renggli renggli at gmail.com
Sat May 1 08:07:30 UTC 2010


You cannot #call: or #answer: from within an AJAX callback. That does not work.

Lukas

On 1 May 2010 00:04, John Toohey <johnptoohey at gmail.com> wrote:
> Yep, I figured that, so I refactored to use just Seaside callbacks for
> the login, and not use the Ajax handlers.  I have it working now, but
> then remembered that I had done this before. I have a jQuery button on
> a page, and its callback calls #answer. I've never had a problem with
> that, and the only difference is that, in this case, I used jQuery
> ajax callback:[self answer], rather than jQuery ajax script:[:s| s].
>
> I can see that it may be a problem, but now I'm worried that my other
> code is not correct, and is working only because of timing.
>
>
> On Fri, Apr 30, 2010 at 17:05, Julian Fitzell <jfitzell at gmail.com> wrote:
>> The IllegalStateException (could be a clearer name) is raised if you try to
>> set an HTTP header after the headers have already been written to the
>> socket. So most likely you're using a streaming server and have already
>> started writing to the document body.
>>
>> I can't visualize exactly which header that would be without stepping
>> through it or seeing the stack, but I seem to recall we determined that
>> calling inside an ajax request didn't make sense (could be true for
>> answering to something that was called--as opposed to shown--as well?).
>>
>> Hopefully that gives you a nudge in the right direction. If not, I'd have to
>> dig in further but maybe Lukas knows more off the top of his head.
>>
>> Julian
>>
>> On Fri, Apr 30, 2010 at 5:43 PM, John Toohey <jt at parspro.com> wrote:
>>>
>>> I have a login dialog (jQuery Dialog) is a component that is called
>>> from my root task. Its Login button has an onClick handler like this
>>> :-
>>> onClick: (html jQuery ajax  script: [ :s | self validateLogin:  s])
>>>
>>> During the #validateLogin, the id/password etc are checked, and if
>>> there is a problem, then the script is filled with jQuery calls to
>>> highlight fields and display a message. This works as expected,
>>> however, if all the tests pass, then the #validateLogin replies with
>>> an #answer call. This sends control to my root task, which then
>>> #call's the main page component.
>>>
>>> At this point, Seaside throws an IllegalStateException from #isCommitted.
>>>
>>> If I use a regular callback, then the #answer/#call works, but in that
>>> case I don't have a script to send back to the browser, in error
>>> situations.
>>>
>>> Is the problem because the Ajax handler is terminated by the #answer call?
>>>
>>> --
>>> -JT
>>> _______________________________________________
>>> 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
>>
>>
>
>
>
> --
> -JT
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside mailing list