HI,

giving a quick look at your code it seems that your form's parent and the form itself are removed in onsubmit method when it calls callViewPersonPanel. If you wanna call super.process first and then updateProcessedForm in SubmitOnceForm, you should save current page reference and form path in a couple of fields at the beginning of SubmitOnceForm's process method. Then use this fields in getToken() method instead of 'getPage().getPageReference()' and 'getPageRelativePath()'.

This should work but I'm not sure it's going to solve the back button's problem


Hi Andrea,
Here is form.onSubmit() functionality, as well as the panel swap
functionality and how I call it. It is pretty much all the functionality I
use:

public class CreateEditPersonPanel extends Panel {
    private WebPage parentPage;
    public CreatePersonPanel(String id, WebPage parentPage) {
       super(id);
       this.parentPage = parentPage;
       add( new PersonForm( "genericPersonCreationForm", (IModel<Person>)
getDefaultModel() ) );
   }
    ...
    private void callViewPersonPanel(Long personID){    
       //get parent page, pane container
       parentPage.replaceCurrentPanelWithViewPerson(personID);
    }
    ...
    private class PersonForm extends SubmitOnceForm<Person>  {
       @Override
       protected void onSubmit() {
          WicketApplication.get().getPersons_service().savePerson(person);
          callViewPersonPanel(person.getId());
      }
   }
}
And on the Parent page I have the following functionality:
  public class ParentPage extends WebPage {
...
    public void replaceCurrentPanelWithViewPerson(long personID){
        viewGenericPersonPanel = new ViewGenericPersonPanel("mainPanel", 
personID);
        currentPanel.replaceWith(viewGenericPersonPanel);
        currentPanel = viewGenericPersonPanel;
    }
}

I'm sorry I cannot spot where I might have gone wrong.
Thanks for your help,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Cookbook-preventing-multiple-form-submits-tp3535159p3536181.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to