Wicket
  1. Wicket
  2. WICKET-4182

Back button and multiple tabs with forms

    Details

      Description

      There are two issues I want to report. If they are bugs og features, I don't know, but they cause trouble for our application if we are supposed to upgrade from 1.4.18 to 1.5.2.

      Issue 1 - Multiple tabs: We have two pages with forms, open up PageA in one tab and PageB in a second tab (in this order). Then we fill in data in PageA and submit, and then open tab with PageB and fill in data. If we check the model and domain objects none of the submits have been attached to the model. Only the newest opened tab is actually submitting data to the model.

      Issue 2 - Back button: We have two pages with forms - fill in data in PageA and submit - this redirects to PageB (also has a form) and use the back button to get to PageA. Now we change values and submit again. The new values are not submitted to the model.

      I'll attach a quickstart on this.

      1. myproject.zip
        28 kB
        Charlie Midtlyng

        Activity

        Hide
        Charlie Midtlyng added a comment -

        Thanks for feedback and a good solution.

        Show
        Charlie Midtlyng added a comment - Thanks for feedback and a good solution.
        Hide
        Martin Grigorov added a comment -

        I verify that using LDM makes the application working as expected.
        Andrea, thanks for the investigation!

        Show
        Martin Grigorov added a comment - I verify that using LDM makes the application working as expected. Andrea, thanks for the investigation!
        Hide
        Andrea Del Bene added a comment -

        BTW, the code above should solve also the first problem (Multi tabs).
        Happy upgrading .

        Show
        Andrea Del Bene added a comment - BTW, the code above should solve also the first problem (Multi tabs). Happy upgrading .
        Hide
        Andrea Del Bene added a comment -

        For your second problem:

        I've played a little with your quickstart project. With Wicket 1.4 when you press back button (PageB to PageA) the object model (FormData) is not deserialized to the version used by PageA. Don't know if it is a bug of 1.4 but under Wicket 1.5 is not that way and the model object is restored to the previous version if you click back button.

        If you wanna be sure that your pages use always the FormData instance 'CustomSession.get().formData' you should compose your CompundPropertyModel with a LoadableDetachableModel:

        IModel<FormData> model = new CompoundPropertyModel<FormData>(
        new LoadableDetachableModel(){
        @Override
        protected Object load()

        { return CustomSession.get().formData; }

        });

        I've tested it and it works.

        Show
        Andrea Del Bene added a comment - For your second problem: I've played a little with your quickstart project. With Wicket 1.4 when you press back button (PageB to PageA) the object model (FormData) is not deserialized to the version used by PageA. Don't know if it is a bug of 1.4 but under Wicket 1.5 is not that way and the model object is restored to the previous version if you click back button. If you wanna be sure that your pages use always the FormData instance 'CustomSession.get().formData' you should compose your CompundPropertyModel with a LoadableDetachableModel: IModel<FormData> model = new CompoundPropertyModel<FormData>( new LoadableDetachableModel(){ @Override protected Object load() { return CustomSession.get().formData; } }); I've tested it and it works.
        Hide
        Charlie Midtlyng added a comment -

        Quickstart project with two forms and a summary page.

        Show
        Charlie Midtlyng added a comment - Quickstart project with two forms and a summary page.

          People

          • Assignee:
            Unassigned
            Reporter:
            Charlie Midtlyng
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development