Most likely I'll commit it today in master as it was approved by review board.
Br's, Marius On Jan 14, 9:53 am, Adam Warski <[email protected]> wrote: > I would of course be very +1 to include the ajaxSubmit :). Thanks for the > work. > > This looks a bit different to the button I tried before, maybe you have a > patch so that I can try it out on the test app? > > Adam > > On Jan 12, 2010, at 8:39 PM, Marius wrote: > > > Dear all, > > > Recently (and not only) there have been discussions about ajax forms > > and their submit Scala functions not being called and that's because > > JQuery's form serialization doesn't serialize the input submits (for > > pertinent reasons). The workaround is as you know to use hidden > > fields. > > > Adam also wanted an ajax form with multiple submit buttons taking > > different actions depending on which button is being called. This is > > also *doable* using hidden fields .... but not quite from elegant. > > > I've experimented a way to allow ajax form submission but after all > > form field functions are being called your own ajax Scala function is > > being called (with no hidden fields). the idea is this: > > > 1. I added an SHtml.ajaxSubmit which has the same signature with > > SHtml.submit > > 2. At js level I added a liftAjax.lift_uriSuffix > > 3. When clicking the ajaxSubmit button we set the > > liftAjax.lift_uriSuffix with the function name value. This is the > > function name of your scala function. Hence your scala function for > > ajaxSubmit will be called after form field functions are called. > > > In short we "piggy back" the Scala function info on top of the > > serialized form info. > > > I tested it and it works just fine for me: > > > Using it looks something like like: > > > ajaxForm(bind("hello", xhtml, > > "field1" -> text("", (s) => {println("field1 = " + s)}), > > "field2" -> text("", (s) => {println("field2 = " + s)}), > > "field3" -> text("", (s) => {println("field3 = " + s)}), > > "submit" -> ajaxSubmit("Press me", () => { > > println("my ajax func called.") > > Noop > > })) > > > ... you got the idea. > > > This of course allows putting virtually any number of ajax submit > > buttons and the right function will be called on server side. > > > I'm thinking to add this to Lift but first I'd like to know your > > thoughts. > > > Br's, > > Marius > > -- > > 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 > > athttp://groups.google.com/group/liftweb?hl=en.
-- 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.
