I'm having some trouble with with a button - I'm new to wicket and web development in general and apologize for the silly question.

The button enables/disables things based on their current state, so I use a model to set the value to "Enable" or "Disable" accordingly. OnSubmit then redraws the panel containing the button; but, while I can confirm that the thing has been changed and other components dependent on it's state behave appropriately, the value for the button doesn't change. What am I missing?

The code looks something like this:

public UserDetails (String id, final Principal user){
      ....
      Form form = new Form("form"){
           protected void onSubmit(){
               MainPage mainPage = (MainPage) findParent(MainPage.class);
               mainPage.updateAll(user);
           }
       };
       add(form);
//Set the model for the enable/disable account button also known as "toggle"
       Model action = new Model();
       if(user.getAccount().getEnabled()){
           action.setObject("Disable");
       }else action.setObject("Enable");
Button toggle = new Button("toggle", action){
           public void onSubmit(){
               //Toggle the enablement
               facade.toggleEnable(user);
           }
       };
       form.add(toggle);
      ...
}

public class MainPage extends WebPage{
    ...
   public void updateAll(Principal user){
       addOrReplace(new UserDetails("userDetails", user));
       addOrReplace(new UserList("userList"));
   }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to