On Thu, Jan 21, 2010 at 4:36 PM, Kris Nuttycombe <[email protected]> wrote: > On Thu, Jan 21, 2010 at 2:43 PM, Marius <[email protected]> wrote: >> >> >> On Jan 21, 11:15 pm, Kris Nuttycombe <[email protected]> >> wrote: >>> On Thu, Jan 21, 2010 at 12:23 PM, Marius <[email protected]> wrote: >>> > Instead of >>> >>> > "submit" -> SHtml.submit("Parse", () => ()) >>> >>> > use: >>> >>> > "submit" -> SHtml.ajaxSubmit("Parse", () => ()) >>> >>> > you can also send normal forms via ajax like: >>> >>> > SHtml.submitAjaxForm("formId", () => { >>> >>> > /// Do your stuff here. This function will be called after form >>> > field functions are executed. >>> > Noop >>> > }) >>> >>> > Br's, >>> > Marius >>> >>> Thanks, Marius. I've just updated from M1 to the snapshot to get >>> ajaxSubmit; however, it doesn't address my question as to why the >>> function passed to AjaxSubmit doesn't return a JsCmd that can be used >>> to refresh the page. >> >> The ajaxSubmit has the signature: >> >> def ajaxSubmit(value: String, func: () => Any, attrs: (String, String) >> *) >> >> returns an Any because Lift looks for the following: >> >> JsCmd, >> NodeSeq >> JsCommands >> LiftResponse > > I think I must be misunderstanding something - should I expect the > following to work? > > var text: Option[String] = None > ajaxForm( > bind("plan", xhtml, > "dsl" -> textarea("", s => text = Some(s), "id" -> > "dsl_text", "rows" -> "40", "cols" -> "120"), > "submit" -> ajaxSubmit("Create Plan", () => > SetHtml("results", buildPlan(text.get))) > ) > ) > > where there is <div id="results"/> in the rendered page? I don't seem > to get the expected results back, though it's clear from logging that > this is being processed correctly. > > Kris >
A bit more, intriguing information: is SetHtml size-limited? It seems to work fine if what I'm passing back is just a URL or something, but if I pass back a 1.5k error message, the message never seems to appear. Kris -- 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.
