[Seaside] jquery serialization question
Lukas Renggli
renggli at gmail.com
Sun Oct 16 14:35:42 UTC 2011
> 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)) ]) );
- There is a cascade semicolon missing after #serializeForm, but it
probably doesn't matter much.
- You likely want to return false to the click handler, otherwise a
full submit will be triggered. You can do this by adding
(html jQuery ajax
serializeForm;
onSuccess: ...;
return: false)
> If I execute this by clicking the button the callback for the textArea
> gets invoked twice most of the time (though not every time).
If the AJAX call is faster you get the AJAX submit, then a full submit.
If the full submit is faster, the AJAX call is cancelled by the
browser and you get only one submit.
Lukas
--
Lukas Renggli
www.lukas-renggli.ch
More information about the seaside
mailing list