Skip to content

Instantly share code, notes, and snippets.

@totem3
Created December 16, 2011 03:36
Show Gist options
  • Save totem3/1484329 to your computer and use it in GitHub Desktop.
Save totem3/1484329 to your computer and use it in GitHub Desktop.
ajaxText
<lift:surround with="default" at="content">
<lift:AjaxTextTest.greeting>
greeting1: <greeting:text />
<div id="here" />
</lift:AjaxTextTest.greeting>
<lift:AjaxTextTest.greeting2>
greeting2: <greeting:text />
<div id="here2" />
</lift:AjaxTextTest.greeting2>
<lift:AjaxTextTest.greeting3>
greeting3: <greeting:text />
<div id="here3" />
</lift:AjaxTextTest.greeting3>
</lift:surround>
class AjaxTextTest {
def greeting(xhtml:NodeSeq):NodeSeq = {
bind("greeting", xhtml,
"text" -> ajaxText("YourName", (s:String)=> SetHtml("here", Text("Hello, " + s + "!")))
)
}
def greeting2(xhtml:NodeSeq):NodeSeq = {
bind("greeting", xhtml,
"text" -> ajaxText("YourName", true, (s:String)=> SetHtml("here2", Text("Hello, " + s + "!")))
)
}
def greeting3(xhtml:NodeSeq):NodeSeq = {
bind("greeting", xhtml,
"text" -> ajaxText("YourName", false, Call("alert('Hello!')"), (s:String) => SetHtml("here3", Text("Hello, " + s + "!")))
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment