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 2012/11/01 19:30:36 UTC

How to See if a Button Goes To the Server

I appreciate the help so far. 

A somewhat unusual question: We need a way to identify all Buttons which
don't go to the server for anything. Is there a way to identify these
"client-side-only" Buttons?

As an example, we have a Wicket Button constructed the usual way in our
form, but its only action is to erase all fields on the form via JavaScript
(it's a "Reset" button, has an onClick JS action). It doesn't go to the
server and its activity is exclusively client-side.

How can we check for these buttons in our code? Is it the fact that they
don't override an onSubmit()?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-See-if-a-Button-Goes-To-the-Server-tp4653543.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: How to See if a Button Goes To the Server

Posted by Sebastien <se...@gmail.com>.
Hi,

I think there is several ways to achieve that. You can, for instance, have
your own StaticButton class that extends button, then by using
#visitChildren(StaticButton.class) you get these back.
A warning however, not overriding onSubmit does not prevent the button (if
it's of type submit) to post the form to the server. Be sure your button is
of type "button".

Regards,
Sebastien.

On Thu, Nov 1, 2012 at 7:30 PM, eugenebalt <eu...@yahoo.com> wrote:

> I appreciate the help so far.
>
> A somewhat unusual question: We need a way to identify all Buttons which
> don't go to the server for anything. Is there a way to identify these
> "client-side-only" Buttons?
>
> As an example, we have a Wicket Button constructed the usual way in our
> form, but its only action is to erase all fields on the form via JavaScript
> (it's a "Reset" button, has an onClick JS action). It doesn't go to the
> server and its activity is exclusively client-side.
>
> How can we check for these buttons in our code? Is it the fact that they
> don't override an onSubmit()?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-See-if-a-Button-Goes-To-the-Server-tp4653543.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
>
>