[Lift] Ajax Forms and Binding

2009-12-18 Thread Peter Robinett
Hi all,

I think there is a simple answer to this, but I'm a little confused. I
want to update a bound element when my Ajax form is submitted. Here's
a simple version based upon what I gleaned from the wiki and the
mailing list:

lift:Test.form
  pDisplay: test:display //p
  pInput1: test:input1 //p
  pInput2: test:input2 //p
  ptest:submit //p
/lift:Test.form

class Test {
  var display = 
  var input1 = 
  var input2 = 
  def form(xhtml: NodeSeq): NodeSeq = {
SHtml.ajaxForm(
  bind(test, xhtml,
display - display,
input1 - SHtml.text(input1, input1 = _),
input2 - SHtml.text(input2, input2 = _),
submit - SHtml.submit(Submit, () = {}) // empty method
since our hidden item will be called instead?
  ) ++
  SHtml.hidden(() = {
   display = input1 + input2
   // push an update to display here?
   ()
  })
)
  }
}

Am I on the right track? How do I actually get test:display / to be
updated?

Thanks,
Peter

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




Re: [Lift] Ajax Forms and Binding

2009-12-18 Thread David Pollak
On Fri, Dec 18, 2009 at 3:22 PM, Peter Robinett pe...@bubblefoundry.comwrote:

 Hi all,

 I think there is a simple answer to this, but I'm a little confused. I
 want to update a bound element when my Ajax form is submitted. Here's
 a simple version based upon what I gleaned from the wiki and the
 mailing list:

 lift:Test.form
  pDisplay: test:display //p
  pInput1: test:input1 //p
  pInput2: test:input2 //p
  ptest:submit //p
 /lift:Test.form

 class Test {
  var display = 
  var input1 = 
  var input2 = 
  def form(xhtml: NodeSeq): NodeSeq = {
SHtml.ajaxForm(
  bind(test, xhtml,
display - span id=i_like_yaks{display}/span,
input1 - SHtml.text(input1, input1 = _),
input2 - SHtml.text(input2, input2 = _),
submit - SHtml.submit(Submit, () = {}) // empty method
 since our hidden item will be called instead?
  ) ++
  SHtml.hidden(() = {
   display = input1 + input2


SetHtml(i_like_yaks, Text(display))

  })
)
  }
 }

 Am I on the right track? How do I actually get test:display / to be
 updated?

 Thanks,
 Peter

 --

 You received this message because you are subscribed to the Google Groups
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.





-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.