First of all instead of: ("onclick" -> ajaxCall(JsRaw("$('#whatField').attr('value')"), s => updateWhat(s))._2)
I would use: ("onclick" -> ajaxCall(ValById("whatField"), s => updateWhat(s))._2) That should work .... I think in your case you are setting the value attribute of the text field to "lambda.x.x" and "$('#whatField').attr ('value') is just returning the 'value' attribute of the whatField node. This returns the value set statically which is different from document.getElementById("whatField").value. I know it's a bit odd ... Br's, Marius On May 3, 10:51 am, Meredith Gregory <lgreg.mered...@gmail.com> wrote: > Marius, > > Thanks for the tip! That gets me a little further. However, what i really > don't understand is why it is that after i have modified the textbox from > "lambda x.x" to "lambda x.(x x)", then when i type > $('#whatField').attr('value') in the javascript evaluation window in firebug > it's returning "lambda x.x". How do i access the contents of the textbox > except by that call? > > Best wishes, > > --greg > > > > On Sun, May 3, 2009 at 12:11 AM, marius d. <marius.dan...@gmail.com> wrote: > > > Greg, > > > ajaxCall returns a tuple (String, JsExp) ... so when you use it try > > something like: > > > ("onclick" -> ajaxCall(JsRaw("$('#whatField').attr('value')"), s => > > updateWhat(s))._2) > > > Br's, > > Marius > > > On May 3, 9:00 am, Meredith Gregory <lgreg.mered...@gmail.com> wrote: > > > Lifted, > > > > When i look at the button behavior using firebug, this is the following > > > error i see. > > > > F891109765602PT1 is not defined > > > onclick(click clientX=950, clientY=152)1tbfBLwe...6bg%3D%3D (line 2) > > > (F891109765602PT1, lift_ajaxHand...whatField").attr("value"), null, > > null)); > > > > It would appear that however the > > > > ajaxCall(JsRaw("$('#whatField').attr('value')") > > > > is working it is setting up a handle that is stale by the time the > > behavior > > > is actually invoked. This is behind-the-scenes stuff for a programmer > > like > > > me. It's part of what lift is s'posed to provide. Moreover, i get no help > > > from the compiler. The code i have written is well-typed. Any help would > > be > > > greatly appreciated. > > > > Best wishes, > > > > --greg > > > > On Sat, May 2, 2009 at 8:50 PM, Meredith Gregory > > > <lgreg.mered...@gmail.com>wrote: > > > > > Lifted, > > > > > i'm putting together a little lift-based testharness in which to > > evaluate > > > > various solutions to the challenge Martin posted recently regarding > > scalable > > > > abstractions for a little lambda interpreter. You can get a copy of the > > app > > > > here <http://svn.biosimilarity.com/src/open/rlambda/trunk/>. (Please > > note: > > > > this is a testharness and not a proposed solution. i've got a couple of > > > > solutions in mind, but before i post them, i'd like to put them in a > > web > > > > "container".) As usual, i'm running into problems on the frontend. i'm > > not > > > > getting expected callback behavior, and, moreover, the code i'm using > > used > > > > to work fine. > > > > > The snippet code is included below this email's closing. The relevant > > > > fragment is listed just below. The behavior i see is that the button > > > > produces no behavior on the server at all. The CR/LF event on the text > > field > > > > causes updateWhat to be called twice. Any advice on the frontend > > behavior > > > > would be greatly appreciated. > > > > > def whatNode(termStr : String) = { > > > > theTerm = termStr > > > > theClientRequestStr = evalStr() > > > > var theParseResponseStr : String = > > > > ("failure: " + theClientRequestStr + "\n"); > > > > try { > > > > theParseResponseStr = > > > > theREPL.showClientRequestParseTree(theClientRequestStr) > > > > println( "parsed : " + theParseResponseStr ); > > > > //theREPL.readEvalPrint(theClientRequestStr) > > > > } > > > > catch { > > > > case e => { > > > > val sw : java.io.StringWriter = new java.io.StringWriter( ); > > > > e.printStackTrace( new java.io.PrintWriter( sw, true ) ); > > > > theParseResponseStr = theParseResponseStr + e.toString > > > > } > > > > } > > > > <div id="parseTree">{theParseResponseStr}</div> > > > > } > > > > > def updateWhat(str: String): JsCmd = { > > > > println("updateWhat with " + str) > > > > JsCmds.SetHtml("parseTree", whatNode(str)) > > > > } > > > > > def show(xhtml: NodeSeq): NodeSeq = { > > > > <xml:group> > > > > <label for="whatField">Term :</label> > > > > { text("lambda x.x", (updateWhat _)) % ("size" -> "60") % ("id" > > -> > > > > "whatField") } > > > > { <button type="button">{?("Go")}</button> % > > > > ("onclick" -> ajaxCall(JsRaw("$('#whatField').attr('value')"), s > > => > > > > updateWhat(s))) } > > > > <br/> > > > > <div id="parseTree">{whatNode(evalStr())}</div> > > > > </xml:group> > > > > } > > > > > Best wishes, > > > > > --greg > > > > > package com.biosimilarity.reflection.snippet > > > > > import net.liftweb._ > > > > import http._ > > > > import S._ > > > > import SHtml._ > > > > import util._ > > > > import Helpers._ > > > > import mapper._ > > > > import textile._ > > > > import js.{JE, JsCmd, JsCmds} > > > > import JsCmds._ > > > > import JE._ > > > > > import com.biosimilarity.reflection.model.REPL > > > > > import scala.xml._ > > > > > class REPLForm { > > > > val theREPL = new REPL() > > > > var theTerm : String = "lambda x.x" > > > > var theClientRequestStr : String = evalStr() > > > > > def evalStr() = theTerm > > > > def clientRequestRequest() = theClientRequestStr > > > > > def parseTreeNode(clientRequestStr : String) = { > > > > theClientRequestStr = clientRequestStr.replace( "\n", "" ); > > > > var theParseResponseStr : String = > > > > ( "failure: " + theClientRequestStr + "\n" ); > > > > try { > > > > theParseResponseStr = > > > > theREPL.showClientRequestParseTree(theClientRequestStr) > > > > //theREPL.readEvalPrint(theClientRequestStr) > > > > } > > > > catch { > > > > case e => { > > > > val sw : java.io.StringWriter = new java.io.StringWriter( ); > > > > e.printStackTrace( new java.io.PrintWriter( sw, true ) ); > > > > theParseResponseStr = theParseResponseStr + e.toString > > > > } > > > > } > > > > <div id="parseTree">{theParseResponseStr}</div> > > > > } > > > > > def whatNode(termStr : String) = { > > > > theTerm = termStr > > > > theClientRequestStr = evalStr() > > > > var theParseResponseStr : String = > > > > ("failure: " + theClientRequestStr + "\n"); > > > > try { > > > > theParseResponseStr = > > > > theREPL.showClientRequestParseTree(theClientRequestStr) > > > > println( "parsed : " + theParseResponseStr ); > > > > //theREPL.readEvalPrint(theClientRequestStr) > > > > } > > > > catch { > > > > case e => { > > > > val sw : java.io.StringWriter = new java.io.StringWriter( ); > > > > e.printStackTrace( new java.io.PrintWriter( sw, true ) ); > > > > theParseResponseStr = theParseResponseStr + e.toString > > > > } > > > > } > > > > <div id="parseTree">{theParseResponseStr}</div> > > > > } > > > > > def updateWhat(str: String): JsCmd = { > > > > println("updateWhat with " + str) > > > > JsCmds.SetHtml("parseTree", whatNode(str)) > > > > } > > > > > def show(xhtml: NodeSeq): NodeSeq = { > > > > <xml:group> > > > > <label for="whatField">Term :</label> > > > > { text("lambda x.x", (updateWhat _)) % ("size" -> "60") % ("id" > > -> > > > > "whatField") } > > > > { <button type="button">{?("Go")}</button> % > > > > ("onclick" -> ajaxCall(JsRaw("$('#whatField').attr('value')"), s > > => > > > > updateWhat(s))) } > > > > <br/> > > > > <div id="parseTree">{whatNode(evalStr())}</div> > > > > </xml:group> > > > > } > > > > } > > > > > -- > > > > L.G. Meredith > > > > Managing Partner > > > > Biosimilarity LLC > > > > 1219 NW 83rd St > > > > Seattle, WA 98117 > > > > > +1 206.650.3740 > > > > >http://biosimilarity.blogspot.com > > > > -- > > > L.G. Meredith > > > Managing Partner > > > Biosimilarity LLC > > > 1219 NW 83rd St > > > Seattle, WA 98117 > > > > +1 206.650.3740 > > > >http://biosimilarity.blogspot.com > > -- > L.G. Meredith > Managing Partner > Biosimilarity LLC > 1219 NW 83rd St > Seattle, WA 98117 > > +1 206.650.3740 > > http://biosimilarity.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@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 -~----------~----~----~----~------~----~------~--~---