You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by eugenebalt <eu...@yahoo.com> on 2011/07/30 02:45:13 UTC

Non-Submit Button Not Getting Called from Form

It's something simple that I'm forgetting, but my non-Submit button (e.g.
"Cancel") is not getting called from my Form.

The button is a simple Button, not Ajax.


My HTML (using [] to avoid rendering here):

[form wicket:id=".." ]
  [input wicket:id="btnReturn" type="button" value="Return to Home Page"
style="width: 300px" /]
[/form]

My Java:

        add(new Button("btnReturn") {

                @Override
                public void onSubmit() {
                    System.out.println("Clicked"); 
               }

            });


Thanks

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3705651.html
Sent from the Users forum 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


Re: Non-Submit Button Not Getting Called from Form

Posted by hariharansrc <ha...@gmail.com>.
Actually what you will do when clicking cancel override onSubmit event
similarly like other buttons

https://cwiki.apache.org/WICKET/multiple-submit-buttons.html

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3705817.html
Sent from the Users forum 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


Re: Non-Submit Button Not Getting Called from Form

Posted by eugenebalt <eu...@yahoo.com>.
Hi Christian, yes I see what you're saying. I can have 2 submit buttons with
separate onSubmit()'s.

But I found an easier solution: to make the Cancel button an
AjaxFallbackLink with an onClick(). That seems to work for me and I don't
have to redo my main Form onSubmit. An AjaxFallbackLink can be mapped to a
button, it seems.

Thanks

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3706525.html
Sent from the Users forum 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


Re: Non-Submit Button Not Getting Called from Form

Posted by Christian Huber <hu...@butterbrot.org>.
If you check the link sent by hariharansrc 
https://cwiki.apache.org/WICKET/multiple-submit-buttons.html you see an 
example with two submit buttons. The difference to your example, as far 
as i can see, is that your second button has not the submit type. To my 
understanding a button that is not of the submit type does not fire it's 
onSubmit method when clicked. Instead those usually have an onClick-Script.

Do you get an error when you try to add two submit buttons?
--
The Sanity Resort <http://sanityresort.blogspot.com/>

Am 30.07.2011 14:39, schrieb eugenebalt:
> I can't make it Submit, I already have another Submit button. This is button
> #2. I need to override its click behavior, and for some reason I'm not
> catching it.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3706227.html
> Sent from the Users forum 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
>

Re: Non-Submit Button Not Getting Called from Form

Posted by eugenebalt <eu...@yahoo.com>.
I can't make it Submit, I already have another Submit button. This is button
#2. I need to override its click behavior, and for some reason I'm not
catching it.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3706227.html
Sent from the Users forum 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


Re: Non-Submit Button Not Getting Called from Form

Posted by Christian Huber <hu...@butterbrot.org>.
Hi!

Try setting the cancel button's type to "submit" instead of "button", 
then the onSubmit method should be called. Though you might have to 
disable default form processing for the cancel button, depending on your 
form.

HTH, Chris

-- 
The Sanity Resort <http://sanityresort.blogspot.com/>

Am 30.07.2011 02:45, schrieb eugenebalt:
> It's something simple that I'm forgetting, but my non-Submit button (e.g.
> "Cancel") is not getting called from my Form.
>
> The button is a simple Button, not Ajax.
>
>
> My HTML (using [] to avoid rendering here):
>
> [form wicket:id=".." ]
>    [input wicket:id="btnReturn" type="button" value="Return to Home Page"
> style="width: 300px" /]
> [/form]
>
> My Java:
>
>          add(new Button("btnReturn") {
>
>                  @Override
>                  public void onSubmit() {
>                      System.out.println("Clicked");
>                 }
>
>              });
>
>
> Thanks
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Non-Submit-Button-Not-Getting-Called-from-Form-tp3705651p3705651.html
> Sent from the Users forum 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
>


<http://sanityresort.blogspot.com/>