Well you could have a hidden for field containing some information
about the submitter, thus when you click the button you first set the
value of the hidden field and then call submitAjaxForm

Or Try:

ajaxButton("Press me would ya'?", SHtml.submitAjaxForm
(form_ID).toJsCmd, (some) => {

 do your stuff here

})

Br's,
Marius

On Jan 10, 2:02 pm, Adam Warski <a...@warski.org> wrote:
> right, I wrote about that in my original post, but how can I execute a 
> button-specific method on the server-side?
>
> Thanks,
> Adam
>
> On Jan 10, 2010, at 12:15 PM, Marius wrote:
>
> > The ajax buttons doesn't have to be inside the form if you use
> > SHtml.submitAjaxForm(form_ID)
>
> > <button onclick={SHtml.submitAjaxForm(form_ID).toJsCmd}>blah</button>
>
> > Br's,
> > Marius
>
> > On Jan 10, 1:08 pm, Adam Warski <a...@warski.org> wrote:
> >> There is also a related problem:
> >> how can I have two ajax buttons on one form which submit the form and 
> >> execute different functions on the server?
>
> >> Using the "standard" trick:
> >> SHtml.ajaxForm(bind(...) ++ SHtml.hidden(submitFunction))
> >> won't work, as I want different functions executed for different buttons.
>
> >> Adam
>
> >> On Jan 10, 2010, at 10:42 AM, Adam Warski wrote:
>
> >>> Hello,
>
> >>> thanks, but my use-case is a bit different.
>
> >>> I want the whole form to be still submitted using a POST (the "normal" 
> >>> way), and only use ajax for a small fragment of the page (the element 
> >>> editor). So I can't use ajaxForm(...), as this would make all submit 
> >>> buttons use ajax.
>
> >>> Adam
>
> >>> On Jan 9, 2010, at 3:55 PM, greekscala wrote:
>
> >>>> Hello,
>
> >>>> I have a similar use case. For an AjaxForm you have to write:
> >>>> SHtml.ajaxForm(
> >>>>     bind("mytags", xml,
> >>>>      // binding to your tags ...
>
> >>>>       "submit" -> SHtml.submit("do it", save),
> >>>>     ) ++ SHtml.hidden(save)
> >>>>   )
>
> >>>> You dont need to have a form element in your templates for this to
> >>>> work
> >>>> because ajaxForm will wrap the result of the bind method.
>
> >>>> For my listelements checkbox, I attach to the checkbox a function,
> >>>> that adds an Id and the
> >>>> checkbox value to a ListBuffer[(Boolean, String)]. (checked and not
> >>>> checked boxes are submittet)
>
> >>>> Then I filter the List for the selected values a do what I have to do
> >>>> with them.
> >>>> I the above code example, my save method does some db stuff and then
> >>>> returning
> >>>> a JsCmds.SetHtml("an html id", some html/snippet nodeseq) for a
> >>>> redraw.
>
> >>>> Hope this helps a little
>
> >>>> with best regards
>
> >>>> On 9 Jan., 10:48, Adam Warski <a...@warski.org> wrote:
> >>>>> Hello,
>
> >>>>> I have a regular form, which is submitted with a POST (no AJAX here 
> >>>>> yet). The form contains a list, to which you can add and remove 
> >>>>> elements using AJAX. So the add and remove buttons are:
>
> >>>>> "add" -> ajaxButton("Add element", () => { elements += new Element; 
> >>>>> reDraw })
>
> >>>>> The "reDraw" method is a SetHtml for the whole form. Now this almost 
> >>>>> works, with the exception that when I press the "add" button all other 
> >>>>> changes in the form are discarded, as the form is not submitted. So, 
> >>>>> when the button is pressed, I would need to submit the form using ajax 
> >>>>> and execute a given function on the server. In the archives I found 
> >>>>> SHtml.submitAjaxForm(formId) method, which I guess does what I need, 
> >>>>> but I don't know how to combine it with an ajaxButton?
>
> >>>>> --
> >>>>> Thanks,
> >>>>> Adam
> >>>> --
> >>>> 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 
> >>>> 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 lift...@googlegroups.com.
> >>> To unsubscribe from this group, send email to 
> >>> liftweb+unsubscr...@googlegroups.com.
> >>> 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 lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com.
> > 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 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