Thanks for responding, Naftoli.

I tried changing the code to:

    def handleSubmit() =
    {
      Log.info("GOT A SUBMIT IN INVITE")
      net.liftweb.http.js.JsCmds.Run("alert('Hey')")
    }

    ajaxForm(
      bind("elem", xhtml,
           "submit" -> submit("Click", () => handleSubmit() ),
         ) ++ hidden(() => handleSubmit())
    )

The handleSubmit method is still not called. I tried using ajaxButton
instead of submit but that did not help either.

What am I doing wrong?


On Oct 7, 5:06 am, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
> What about an Ajax form?
>
> On Tue, Oct 6, 2009 at 9:52 AM, Somindra  Bhattacharya
>
> <somind...@gmail.com> wrote:
>
> > Hi Everyone,
>
> > I have a comet actor that binds XHTML. The XHTML corresponds to a
> > snippet:
>
> > XHTML for comet actor ->
>
> >  <lift:comet type="RCActor">
> >    <Act:act />
> >  </lift:comet>
>
> > When the comet actor receives a certain message, the render method of
> > the comet actor binds the following XHTML ->
>
> >    <lift:Discuss.invite form="post">
> >       <elem:submit />
> >    </lift:Discuss.invite>
>
> > The Discuss snippet's "invite" method definition is:
>
> >  def invite(xhtml: NodeSeq): NodeSeq =
> >  {
>
> >     def handleSubmit() =
> >     {
> >        Log.info("GOT A SUBMIT IN INVITE")
> >     }
>
> >     bind("elem", xhtml,
> >         "submit" -> submit("Click", () => handleSubmit()))
> >  }
>
> > The page does not contain this form when it is first loaded. When the
> > actor receives a certain message, it binds the XHTML (Discuss.invite)
> > to the page and the form and the "submit" button are rendered
> > properly.
>
> > However, when I click on the submit button, the "handleSubmit" method
> > is not called. Instead, the browser displays a page with the text
> > "window.location=/".
> > If I use the browser back button and re-visit the page with the comet
> > actor, the submit button works (i.e., handleSubmit() is called and I
> > can see the info log).
>
> > Is this approach "legal"? Is there a way to make a form submit if it
> > was not originally part of the page?
>
> > Thanks,
> > Som
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to