[Seaside] jquery serialization question

Bob Arning arning at charm.net
Sun Oct 16 14:01:21 UTC 2011


Probably wouldn't hurt to offer more detail, but here is a runnable 
version of your snippet that seems to happen once per click.

renderContentOnLarry1: html

     | fromCallback counter |

     counter _ 0.
     html form: [
         html textArea
             id: #postStatusTextArea;
             callback: [ :value | counter _ counter + 1. fromCallback _ 
value.];
             value: 'initial text'.
         html div
             onClick: (html jQuery ajax serializeForm
                 onSuccess:
                     (html jQuery ajax
                         script: [ :s |
                             s add: ((html jQuery: #postStatusTextArea) 
value: counter asString,' [',fromCallback asString,']').
                             s add: ((html jQuery: #activityStream) 
prepend: counter asString) ]) );
             with: 'click here'
     ]

My guess would be that you used a submitButton that forced a 
serialization/callback in addition to the explicit one you included.

Cheers,
Bob


On 10/16/11 9:43 AM, Larry White wrote:
> Hi,
>
> I'm having some strange problem with Jquery/Seaside.
>
> I'm trying to serialize a form containing a single testArea when the
> submit button is clicked. I have an onClick handler for the submit
> button that does this:
>
> (html jQuery ajax serializeForm
> 						onSuccess:
> 							(html jQuery ajax
> 								script: [ :s |
> 									s add: ((html jQuery: #postStatusTextArea) value: '').
> 									s add: ((html jQuery: #activityStream) prepend:
> (CBActivityComponent post: self session user posts first)) ]) );
>
> If I execute this by clicking the button the callback for the textArea
> gets invoked twice most of the time (though not every time).
>
> I tried wrapping the same logic inside a block instead of parens like so:
>
> [html jQuery ajax serializeForm
> 						onSuccess:
> 							(html jQuery ajax
> 								script: [ :s |
> 									s add: ((html jQuery: #postStatusTextArea) value: '').
> 									s add: ((html jQuery: #activityStream) prepend:
> (CBActivityComponent post: self session user posts first)) ]) ];
>
> Now it submits exactly once every time. However, other javascript
> functionality on the pages stops working.
>
> So my questions are, should the onClick be inside a block as in the
> second example, and if not, does anyone have any idea why the
> non-block version would serialize twice per click (some of the time).
>
> thanks much.
>
> Larry
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20111016/e1a22870/attachment.html


More information about the seaside mailing list