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/08/13 16:40:40 UTC

WicketRuntimeException: "Submit Button ... is not enabled"

We have an Ajax button which, when clicked, occasionally produces this
WicketRuntimeException:

 ERROR [WebContainer : 17] (RequestCycle.java:1521) - Submit Button
myPanel:editButton (path=myForm:myPanel:editButton) is not enabled
org.apache.wicket.WicketRuntimeException: Submit Button myPanel:editButton
(path=myForm:myPanel:editButton) is not enabled
        at
org.apache.wicket.markup.html.form.Form$2.component(Form.java:626)
        at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:878)
        at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:893)
        at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:893)
        at
org.apache.wicket.markup.html.form.Form.findSubmittingButton(Form.java:602)
        at
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:875)
        at sun.reflect.GeneratedMethodAccessor2603.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
        at 

Is there a race condition of some kind happening here? Thanks



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180.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: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by eugenebalt <eu...@yahoo.com>.
Thanks Sven, that was it! They were clicking again while the form was still
processing.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180p4653019.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: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by Sven Meier <sv...@meiers.net>.
You're probably experiencing double clicks on your ajax buttons.
When the second request reaches the button, is is already disabled again.

Check this:
http://wicketinaction.com/2008/12/preventing-double-ajax-requests-in-3-lines-of-code/

Sven

On 10/16/2012 06:24 PM, eugenebalt wrote:
> Hi,
>
> Sorry, I have to bump thread back up again. We still have no clear idea how
> to address this issue, which only happens sporadically on our production
> server (and we can't reproduce it locally).
>
> We have screens with Ajax Buttons which submit forms, but also disable/hide
> these Ajax buttons. I am guessing, based on earlier answers, that sometimes,
> the disable/hide happens *BEFORE* the Form Submit, and Wicket doesn't like
> that. Wicket requires that all form fields be enabled and visible to ensure
> form integrity.
>
> The simplest question is, how do we turn off this check in Wicket, or how do
> we guard against this error?
>
> "Submit button is not visible" or "Submit button is enabled".
>
> We can't rewrite our app from scratch, it has a lot of screens and a lot of
> functionality, we do need to toggle these buttons when submitting the form.
> Please, any help would be appreciated.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180p4653012.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
>


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


Re: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by eugenebalt <eu...@yahoo.com>.
Hi,

Sorry, I have to bump thread back up again. We still have no clear idea how
to address this issue, which only happens sporadically on our production
server (and we can't reproduce it locally).

We have screens with Ajax Buttons which submit forms, but also disable/hide
these Ajax buttons. I am guessing, based on earlier answers, that sometimes,
the disable/hide happens *BEFORE* the Form Submit, and Wicket doesn't like
that. Wicket requires that all form fields be enabled and visible to ensure
form integrity.

The simplest question is, how do we turn off this check in Wicket, or how do
we guard against this error? 

"Submit button is not visible" or "Submit button is enabled".

We can't rewrite our app from scratch, it has a lot of screens and a lot of
functionality, we do need to toggle these buttons when submitting the form.
Please, any help would be appreciated.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180p4653012.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: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by Paul Bors <pa...@bors.ws>.
As an idea, I tend to keep the panel edit/view state as a boolean and then
toggle the label on the button and control the behavior of the button press
via an if-else statement in the onSubmit() of the button.

This helps because I only have a single Edit/Save button and I toggle from
labels to form fields on the fly controlling those components via
AjaxFallback*** implemented in a single refrechPanel() method that calls
setVisable(editMode) for all the components that are to toggle or hide.

Also you can do this to the DataTable rows when necessary similar to how the
Editable tree table works:
http://www.wicket-library.com/wicket-examples/ajax/tree/table/editable?3

I get away with all this because I have my own generic labeled form
component that can toggle from a label to a form component and have a
<label> html tag as well as an Help icon and feedback panel associated with
it.

~ Thank you,
  Paul Bors

-----Original Message-----
From: eugenebalt [mailto:eugenebalt@yahoo.com] 
Sent: Tuesday, August 14, 2012 12:16 PM
To: users@wicket.apache.org
Subject: Re: WicketRuntimeException: "Submit Button ... is not enabled"

It is true that we have multiple buttons on our form that we are
disabling/hiding selectively.

Our scenario: a panel that contains the button "Edit", and then when it's
clicked, the panel opens and "Edit" is replaced by two other visible buttons
- "Submit" and "Cancel". "Edit" is gone. We need this dynamic behavior to
enable rich, "self-changing" forms.

Example:

add(new Button ("editButton"){
      @Override
	 public boolean isVisible() {
	     return showeditbutton;
	 		}
        	@Override
            public void onSubmit() {     
                  showeditbutton = false;    // hide this one
                  showsavebutton = true;   // show the others
                  showcancelbutton = true;
            }
}

These are global variables/flags on the form. 

So given this "self-changing form" requirement, what's the fastest way to
get rid of this intermittent "Not Enabled / Visible" error? Is there a way
to turn off this validation in Wicket?



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-But
ton-is-not-enabled-tp4651180p4651233.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



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


Re: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by eugenebalt <eu...@yahoo.com>.
It is true that we have multiple buttons on our form that we are
disabling/hiding selectively.

Our scenario: a panel that contains the button "Edit", and then when it's
clicked, the panel opens and "Edit" is replaced by two other visible buttons
- "Submit" and "Cancel". "Edit" is gone. We need this dynamic behavior to
enable rich, "self-changing" forms.

Example:

add(new Button ("editButton"){
      @Override
	 public boolean isVisible() {
	     return showeditbutton;
	 		}
        	@Override
            public void onSubmit() {     
                  showeditbutton = false;    // hide this one
                  showsavebutton = true;   // show the others
                  showcancelbutton = true;
            }
}

These are global variables/flags on the form. 

So given this "self-changing form" requirement, what's the fastest way to
get rid of this intermittent "Not Enabled / Visible" error? Is there a way
to turn off this validation in Wicket?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180p4651233.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: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
No, they are interchangeable.

On 14/08/2012 11:42 AM, eugenebalt wrote:
> Thanks a lot. In our case, we have an AjaxButton that maps to a "input
> type=submit".
>
> Would using the input type "Button" get rid of this problem?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180p4651231.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
>


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


Re: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by eugenebalt <eu...@yahoo.com>.
Thanks a lot. In our case, we have an AjaxButton that maps to a "input
type=submit".

Would using the input type "Button" get rid of this problem?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180p4651231.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: WicketRuntimeException: "Submit Button ... is not enabled"

Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
Hi,

When a form is submitted, it checks whether the submitting component is 
a Wicket component. If it is (your case), it makes sure that it's 
enabled and visible. I guess this is to prevent users manipulating with 
the form submission process. In any case, if any of the 2 conditions is 
not met, the exception is thrown.

This might or might not be caused by a race condition, but it would most 
likely be caused by disabling buttons (or their parents) in your code.

Bertrand

On 13/08/2012 10:40 AM, eugenebalt wrote:
> We have an Ajax button which, when clicked, occasionally produces this
> WicketRuntimeException:
>
>   ERROR [WebContainer : 17] (RequestCycle.java:1521) - Submit Button
> myPanel:editButton (path=myForm:myPanel:editButton) is not enabled
> org.apache.wicket.WicketRuntimeException: Submit Button myPanel:editButton
> (path=myForm:myPanel:editButton) is not enabled
>          at
> org.apache.wicket.markup.html.form.Form$2.component(Form.java:626)
>          at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:878)
>          at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:893)
>          at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:893)
>          at
> org.apache.wicket.markup.html.form.Form.findSubmittingButton(Form.java:602)
>          at
> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:875)
>          at sun.reflect.GeneratedMethodAccessor2603.invoke(Unknown Source)
>          at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>          at java.lang.reflect.Method.invoke(Method.java:599)
>          at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
>          at
>
> Is there a race condition of some kind happening here? Thanks
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketRuntimeException-Submit-Button-is-not-enabled-tp4651180.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
>


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