Thanks David,
but it doesn't work.
I found in impl of SHtml.onSubmitUnit that is possible only for input,
button, textarea, select.
When I use submit button (input type=submit) with SHtml.ajaxSubmit It
works fine.
But what should I do when I want to submit ajax form via onlick js
with callback function on server side?
Solutions:
A.
http://groups.google.com/group/liftweb/browse_thread/thread/9d7043df12bf26b/5f990d681ec20436?lnk=gst&q=ajax+link+submit#5f990d681ec20436
B. My stuff
Snippet:
def comment = {
SHtml.idMemoize{ commentBox =>
var comment = ""
"#b_name" #> SHtml.textarea(comment, comment = _) &
"#b_submit" #> SHtml.ajaxSubmit("Send", () => {Alert(comment) &
commentBox.setHtml()})
} andThen SHtml.makeFormsAjax
}
Template:
<div>
<form class="b_form l:HelloWorld.comment">
<textarea id="b_name" rows="" cols=""></textarea>
<input id="b_submit" type="submit" />
</form>
</div>
Rendered HTML:
<form
onsubmit="liftAjax.lift_ajaxHandler(jQuery('#'+"F82767478474KPYDYS").serialize(),
null, null, null); return false;" id="F82767478474KPYDYS"
class="b_form" action="javascript://">
<textarea id="b_name" rows="" cols="" name="F827674784751Y5GP1"></
textarea>
<input type="submit" id="b_submit"
onclick="liftAjax.lift_uriSuffix = 'zF82767478476WVQNO2=_'; return
true;" name="zF82767478476WVQNO2" value="Send"/>
</form>
1. What SHtml.ajaxSubmit really makes:
a) add function to server function map
b) render js variable "liftAjax.lift_uriSuffix" to input onclick param
2.) When I click button "Send"
a) onsubmit on form is called
b) js form serialize
c) ajax post
d) ...
e) my callback func (from func map) is called
3. So what can I do for example with span
a) I need fill onclick on span tag
b) I made my own func similar to SHtml.ajaxSubmit
c) It put callback func to function map
d) to onclick I render
- js variable "liftAjax.lift_uriSuffix"
- js formLookup func
- js submit form
Is something like this already in Lift, if not can it be?
Thanks a lot for replies.
Vlad.
> Visi.Pro, Cloud Computing for the Rest of Ushttp://
visi.pro
> Lift, the simply functional web frameworkhttp://
liftweb.net