[Seaside] Re: Form, serialize:, answer: and callback:
Johan Brichau
johan at inceptive.be
Wed Jun 12 15:05:46 UTC 2013
Is the form serialized?
On 12 Jun 2013, at 11:36, Dave <lasmiste at gmail.com> wrote:
> Hi Johan,
> In your snippet there is a mix of my code, I don't need to "answer:" on
> 'Update' but on 'ok'.
>
> Anyway, I tried to use "onComplete:" this way:
>
> html form:[
> ...
> html button onClick: (html jQuery ajax serializeForm; onComplete: (html
> javascript callback: [ self answer: itsVisit ]));
> text: 'ok'.
> ...
> html div with: [
> ...
> html button onClick: html jQuery ajax serializeForm; with: 'Update'
> ...
> ]
> ]
>
>
> but it doesn't work, "answer:" is not called
> Dave
>
>
> Johan Brichau-2 wrote
>> Hi Dave,
>>
>> You can use the onComplete: option of a jQAjax and trigger a full page
>> request from javascript:
>>
>> html button
>> onClick: (html jQuery ajax
>> serializeForm;
>> onComplete: (html javascript callback: [self answer: 'tadaaa!']);
>> with: 'Update'
>>
>> cheers,
>> Johan
>>
>> On 12 Jun 2013, at 10:47, Dave <
>
>> lasmiste@
>
>> > wrote:
>>
>>> Hi Johan,
>>> You described the concetps very well. I'm trying to better explain my
>>> issue.
>>>
>>> Unfortunately I have to send form data to the server twice: once without
>>> changing page and once performing a full regular callback.
>>> So at first my code was:
>>>
>>> html form:[
>>> ...
>>> html submitButton callback: [ self answer: itsVisit ];
>>> text: 'ok'.
>>> ...
>>> html div with: [
>>> ...
>>> html button onClick: html jQuery ajax serializeForm; with: 'Update'
>>> ...
>>> ]
>>> ]
>>>
>>>
>>> That's near a solution because when I click on the 'Update' button the
>>> form
>>> is submitted twice, Lukas pointed the issue
>>> (http://forum.world.st/Jquery-submit-loads-page-tp3919176p3919179.html)
>>> and
>>> provided a workaround (see "return false"). I can implement Lukas'
>>> solution
>>> changing
>>> html button onClick: (html jQuery ajax serializeForm; return: false)
>>> with:
>>> 'Update'
>>> but I'm struggling to find something clearer.
>>>
>>>
>>> So I changed the submitButton with an anchor and onClick: etc. etc.
>>>
>>> html form:[
>>> ...
>>> html anchor onClick:(html jQuery ajax serializeForm callback: [self
>>> answer:
>>> itsVisit ]);
>>> text: 'ok'.
>>> ...
>>> html div with: [
>>> ...
>>> html button onClick: html jQuery ajax serializeForm; with: 'Update'
>>> ...
>>> ]
>>> ]
>>>
>>> Now the form is not submitted twice when I click on the 'Update' anchor,
>>> but
>>> if I click the submitButton answer: does not work.
>>>
>>> Can you see any other solution?
>>> TIA
>>> Dave
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://forum.world.st/Form-serialize-answer-and-callback-tp4692893p4692933.html
>>> Sent from the Seaside General mailing list archive at Nabble.com.
>>> _______________________________________________
>>> seaside mailing list
>>>
>
>> seaside at .squeakfoundation
>
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>> _______________________________________________
>> seaside mailing list
>
>> seaside at .squeakfoundation
>
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/Form-serialize-answer-and-callback-tp4692893p4692950.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
More information about the seaside
mailing list