I am trying to make a simple ajax form. The code is below. The
Javascript error I am getting when I hit the send button is:

uncaught exception ReferenceError: F777221462447MPT is not defined

Am I missing something?

<lift:surround with="default" at="content">
    <h1>Hello FormAjax</h1>
    <lift:HelloFormAjax.show>
        Hello <hello:who/><br/>
        <label for="whoField">Who :</label><hello:whoField/>
        <hello:submit/>
    </lift:HelloFormAjax.show>
</lift:surround>

create src/main/scala/sandbox/lift/hellodarwin/snippet/HelloFormAjax
package sandbox.lift.hellodarwin.snippet

import scala.xml.NodeSeq
import net.liftweb.http.S._
import net.liftweb.http.SHtml._
import net.liftweb.util.Helpers._
import net.liftweb.http.js.{JsCmd, JsCmds}

class HelloFormAjax {
  def whoNode(str: String) = <span id="who">{str}</span>

  def updateWho(str: String): JsCmd = {
    println("updateWho on " + str)
    JsCmds.Run("$('#who').text('"+str+"')")
  }

  def show(xhtml: NodeSeq): NodeSeq = {
    bind("hello", xhtml,
        "whoField" -> text("world", null) % ("size" -> "10") % ("id" -
> "whoField"),
        "submit" -> <button type="button">{?("Send")}</button> %
("onclick" -> ajaxCall(JsRaw("$('#whoField').attr('value')"), s =>
updateWho(s))),
        "who" -> whoNode("world")
    )
  }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to