You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Garret Wilson <ga...@globalmentor.com> on 2014/10/09 19:29:32 UTC

disabling IndicatingAjaxButton during submision?

IndicatingAjaxButton is nice. But I need one more step: I need the 
button to be disabled during submission.

Mystic Coders indicated a solution 
<http://www.mysticcoders.com/blog/disabling-an-ajax-submit-button/>, but 
that doesn't seem to work with Wicket 7.

Some have filed bugs to Wicket 
<https://issues.apache.org/jira/browse/WICKET-5360>  and filed bugs to 
Wicket stuff <https://github.com/wicketstuff/core/issues/272> to have 
this added, but were turned down.

In the Wicket documentation there is some complicated code 
<http://wicket.apache.org/guide/guide/ajax.html#ajax_6> for adding 
layers and having indicators---but I already have an indicator. I just 
want to disable the button.

How can I simply disable the Ajax button during submission? I can't find 
the page that tells me how to do this---but I find lots of people 
wanting to do it, and lots of people providing complicated workarounds 
that break from one version of Wicket to the next. Any easy solutions?

Thanks in advance,

Garret

Re: disabling IndicatingAjaxButton during submision?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

As explained elsewhere the disabling of a button/link/... is not a single
solution that works for everyone. That's why it is not part of Wicket
itself.

If it is just about suppressing the clicks on the button then using
AjaxChannel.Type.ACTIVE is good enough. By using ACTIVE type you tell
Wicket to not execute any Ajax request if there is an active (currently
running) one.

But most probably you want additionally some visual effect that tells the
user that the button is disabled. And here each application may have
different requirements.
Some apps may change the color of the button. This cannot be generic
solution because Wicket devs cannot mandate what color should be used.
Another solution is to change the box shadow, making the effect of a
pressed button. Again Wicket cannot prescribe such solution for all apps.
It won't even work for older IEs.
Probably the most common solution is to use a veil on the whole screen (or
just part of it). For example Apache Isis uses global Ajax listeners to
show/hide a veil -
https://github.com/martin-g/isis/blob/ISIS-537-use-bootstrap/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js#L52-L57.
Additionally it uses FontAwesome spinning font icon (
http://fontawesome.io/examples/) instead of IndicatingAjaxButton's
spinner.gif.

As you can see there are many ways to achieve "disabling an action". Wicket
is mature enough to give you the freedom to choose the one that fits the
best your functional and visual requirements.

As always - if Wicket users (like you) convince us that a generic
improvement is possible then we will consider it!



On Fri, Oct 10, 2014 at 1:44 AM, Garret Wilson <ga...@globalmentor.com>
wrote:

> One of the reasons I chose Wicket for my client's project was that I
> expected that at this level of maturity Wicket would support the most
> common use cases . (Disabling a submission button during submission is one
> of the most common use cases I can think of.)
>
> Let me first say that IndicatingAjaxButton is really cool, and works
> great! It was just what I needed. Thanks to whoever wrote it.
>
> Disabling the submission button during submission, however, is just going
> to load me down a rat's hole of research and experimentation and
> trial-and-error and half-solutions. We have a tight deadline to meet. We're
> going to have to go with just IndicatingAjaxButton and leave it at that.
> Hopefully we can come back and address this in a future version of our
> project.
>
> I'm just explaining our situation as it is. Nothing  personal directed to
> anyone, and I appreciate the suggestions from Martin Grigorov.
>
> Garret
>
>
> On 10/9/2014 12:29 PM, Garret Wilson wrote:
>
>> IndicatingAjaxButton is nice. But I need one more step: I need the button
>> to be disabled during submission.
>>
>> Mystic Coders indicated a solution <http://www.mysticcoders.com/
>> blog/disabling-an-ajax-submit-button/>, but that doesn't seem to work
>> with Wicket 7.
>>
>> Some have filed bugs to Wicket <https://issues.apache.org/
>> jira/browse/WICKET-5360>  and filed bugs to Wicket stuff <
>> https://github.com/wicketstuff/core/issues/272> to have this added, but
>> were turned down.
>>
>> In the Wicket documentation there is some complicated code <
>> http://wicket.apache.org/guide/guide/ajax.html#ajax_6> for adding layers
>> and having indicators---but I already have an indicator. I just want to
>> disable the button.
>>
>> How can I simply disable the Ajax button during submission? I can't find
>> the page that tells me how to do this---but I find lots of people wanting
>> to do it, and lots of people providing complicated workarounds that break
>> from one version of Wicket to the next. Any easy solutions?
>>
>> Thanks in advance,
>>
>> Garret
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: disabling IndicatingAjaxButton during submision?

Posted by Garret Wilson <ga...@globalmentor.com>.
One of the reasons I chose Wicket for my client's project was that I 
expected that at this level of maturity Wicket would support the most 
common use cases . (Disabling a submission button during submission is 
one of the most common use cases I can think of.)

Let me first say that IndicatingAjaxButton is really cool, and works 
great! It was just what I needed. Thanks to whoever wrote it.

Disabling the submission button during submission, however, is just 
going to load me down a rat's hole of research and experimentation and 
trial-and-error and half-solutions. We have a tight deadline to meet. 
We're going to have to go with just IndicatingAjaxButton and leave it at 
that. Hopefully we can come back and address this in a future version of 
our project.

I'm just explaining our situation as it is. Nothing  personal directed 
to anyone, and I appreciate the suggestions from Martin Grigorov.

Garret

On 10/9/2014 12:29 PM, Garret Wilson wrote:
> IndicatingAjaxButton is nice. But I need one more step: I need the 
> button to be disabled during submission.
>
> Mystic Coders indicated a solution 
> <http://www.mysticcoders.com/blog/disabling-an-ajax-submit-button/>, 
> but that doesn't seem to work with Wicket 7.
>
> Some have filed bugs to Wicket 
> <https://issues.apache.org/jira/browse/WICKET-5360>  and filed bugs to 
> Wicket stuff <https://github.com/wicketstuff/core/issues/272> to have 
> this added, but were turned down.
>
> In the Wicket documentation there is some complicated code 
> <http://wicket.apache.org/guide/guide/ajax.html#ajax_6> for adding 
> layers and having indicators---but I already have an indicator. I just 
> want to disable the button.
>
> How can I simply disable the Ajax button during submission? I can't 
> find the page that tells me how to do this---but I find lots of people 
> wanting to do it, and lots of people providing complicated workarounds 
> that break from one version of Wicket to the next. Any easy solutions?
>
> Thanks in advance,
>
> Garret
>


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


Re: disabling IndicatingAjaxButton during submision?

Posted by Garret Wilson <ga...@globalmentor.com>.
On 10/9/2014 1:21 PM, Martin Grigorov wrote:
> ...
> It was as simple as these two lines:
> https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/65529876b31781bc27441b6b2e17559c97abbd0d/bootstrap-extensions/src/main/java/de/agilecoders/wicket/extensions/markup/html/bootstrap/ladda/LaddaAjaxCallListener.java#L15-L16

It looks like I would spend half the day just trying to figure out how 
to integrate yet another library.

So how can I easily and simply disable a button during submission using 
only core Wicket? Can it be done?

Garret

P.S. When somebody wanted to integrate a solution into core Wicket, they 
were turned down <https://issues.apache.org/jira/browse/WICKET-5360>.


Re: disabling IndicatingAjaxButton during submision?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Recently I've added integration for
http://msurguy.github.io/ladda-bootstrap/ to
https://github.com/l0rdn1kk0n/wicket-bootstrap.

It was as simple as these two lines:
https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/65529876b31781bc27441b6b2e17559c97abbd0d/bootstrap-extensions/src/main/java/de/agilecoders/wicket/extensions/markup/html/bootstrap/ladda/LaddaAjaxCallListener.java#L15-L16

i.e. in onBeforeSend() do whatever your button needs to make itself
disabled. In onComplete() revert it.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 9, 2014 at 8:29 PM, Garret Wilson <ga...@globalmentor.com>
wrote:

> IndicatingAjaxButton is nice. But I need one more step: I need the button
> to be disabled during submission.
>
> Mystic Coders indicated a solution <http://www.mysticcoders.com/
> blog/disabling-an-ajax-submit-button/>, but that doesn't seem to work
> with Wicket 7.
>
> Some have filed bugs to Wicket <https://issues.apache.org/
> jira/browse/WICKET-5360>  and filed bugs to Wicket stuff <
> https://github.com/wicketstuff/core/issues/272> to have this added, but
> were turned down.
>
> In the Wicket documentation there is some complicated code <
> http://wicket.apache.org/guide/guide/ajax.html#ajax_6> for adding layers
> and having indicators---but I already have an indicator. I just want to
> disable the button.
>
> How can I simply disable the Ajax button during submission? I can't find
> the page that tells me how to do this---but I find lots of people wanting
> to do it, and lots of people providing complicated workarounds that break
> from one version of Wicket to the next. Any easy solutions?
>
> Thanks in advance,
>
> Garret
>