[Seaside] jquery serialization question

Larry White ljw1001 at gmail.com
Sun Oct 16 13:43:49 UTC 2011


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


More information about the seaside mailing list