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:eugeneb...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



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

Reply via email to