You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pierre Gilquin <pg...@bluewin.ch> on 2008/02/20 11:41:02 UTC

Multi buttons in ajax form

hi all,

I try to have to have 2 buttons in a form. This form is used in an ajax window.

in html, they are 2 standards buttons
<input type="submit" value="Do Task1">
<input type="submit" value="Do Task 2">

In the panel of the ajax window, I have an AjaxFormSubmitBehavior:

form.add(new AjaxFormSubmitBehavior("onsubmit") {
    protected void onSubmit(AjaxRequestTarget target) {
    doTask1();
//    doTask2();
    modal.close(target);
}
protected void onError(AjaxRequestTarget target) {
....

When one button is clicked, the onSubmit method is executed. What can I do to distinct which button was used ?

In some circumstance, I need one button to be invisible or disabled, I try to make it a real wicket object without 
success the following way :
form.add(new WebComponent("button1").add AjaxFormSubmitBehavior(

Thank in advance for your help.

Pierre 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Multi buttons in ajax form

Posted by wicket user <di...@googlemail.com>.
there is a method called findSubmittingButton()

regards
Dipu

On Feb 20, 2008 10:41 AM, Pierre Gilquin <pg...@bluewin.ch> wrote:

> hi all,
>
> I try to have to have 2 buttons in a form. This form is used in an ajax
> window.
>
> in html, they are 2 standards buttons
> <input type="submit" value="Do Task1">
> <input type="submit" value="Do Task 2">
>
> In the panel of the ajax window, I have an AjaxFormSubmitBehavior:
>
> form.add(new AjaxFormSubmitBehavior("onsubmit") {
>    protected void onSubmit(AjaxRequestTarget target) {
>    doTask1();
> //    doTask2();
>    modal.close(target);
> }
> protected void onError(AjaxRequestTarget target) {
> ....
>
> When one button is clicked, the onSubmit method is executed. What can I do
> to distinct which button was used ?
>
> In some circumstance, I need one button to be invisible or disabled, I try
> to make it a real wicket object without
> success the following way :
> form.add(new WebComponent("button1").add AjaxFormSubmitBehavior(
>
> Thank in advance for your help.
>
> Pierre
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Multi buttons in ajax form

Posted by Pierre G <pg...@bluewin.ch>.
Sorry for the noise,

I was able to do it with 2 AjaxButton added on the form.

Pierre


Pierre G wrote:
> 
> hi all,
> 
> I try to have to have 2 buttons in a form. This form is used in an ajax
> window.
> 
> in html, they are 2 standards buttons
> <input type="submit" value="Do Task1">
> <input type="submit" value="Do Task 2">
> 
> In the panel of the ajax window, I have an AjaxFormSubmitBehavior:
> 
> form.add(new AjaxFormSubmitBehavior("onsubmit") {
>     protected void onSubmit(AjaxRequestTarget target) {
>     doTask1();
> //    doTask2();
>     modal.close(target);
> }
> protected void onError(AjaxRequestTarget target) {
> ....
> 
> When one button is clicked, the onSubmit method is executed. What can I do
> to distinct which button was used ?
> 
> In some circumstance, I need one button to be invisible or disabled, I try
> to make it a real wicket object without 
> success the following way :
> form.add(new WebComponent("button1").add AjaxFormSubmitBehavior(
> 
> Thank in advance for your help.
> 
> Pierre 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multi-buttons-in-ajax-form-tp15586379p15586949.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org