On Thu, Jan 21, 2010 at 2:43 PM, Marius <marius.dan...@gmail.com> wrote:
>
>
> On Jan 21, 11:15 pm, Kris Nuttycombe <kris.nuttyco...@gmail.com>
> wrote:
>> On Thu, Jan 21, 2010 at 12:23 PM, Marius <marius.dan...@gmail.com> 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

-- 
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.

Reply via email to