Ajax forms with single POST on submit

17 views
Skip to first unread message

Andrzej Skalski

unread,
Mar 26, 2015, 12:08:00 PM3/26/15
to lif...@googlegroups.com
Hi,

In application I write I use a lot of Ajax forms. I put them on page using JsCmds.Replace, since their contents are dynamic. Although I usually have no need to trace user's edits until he/she decides to save them.

So far I used pieces of code like this (I got it from one of the tutorials):

var note_body = "put your text here"
SHtml.ajaxTextarea(note_body, note_body = _)

but now I see it triggers POST request very often (which is reasonable given the definition). Could anyone point me an example of dynamically generated ajaxForm that consumes user's output after he/she clicks "submit", and does not require many POST operations on the line?

Kindest Regards
Andrzej Skalski

Antonio Salazar Cardozo

unread,
Mar 31, 2015, 9:45:43 AM3/31/15
to lif...@googlegroups.com
If the form is an AJAX form, you don't need an ajaxTextarea—you can just use SHtml.textarea.
The ajax* helpers in SHtml are to push things to the server as they change on the client, while
if you use an AJAX form with regular fields the whole form—including those fields—will get
submitted via AJAX.

Hope that helps!
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages