Wicket
  1. Wicket
  2. WICKET-4109

AutocompleteTextField after Submit does not work

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: 1.5.2
    • Component/s: wicket-extensions
    • Labels:
      None

      Description

      I use an AutocompleteTextfield together with a submit-Button. After once submitting the content oft the AutocompleteTextField the parameter q is added to the URL. After that the autocompletion will only complete the parameter q in the url and not the parameter given by ajax.

      I tracked the problem down to the callbackURL.
      It contains a pattern looking as follows: ....&q=<paramproducedbysubmit>&q=<paramproducedbyajaxautocomplete>
      The callbackurl is build of the parameter q and the extraction of parameters only accepts the first parameter

      1. autocompletebug.zip
        28 kB
        Stefan Mandel
      2. wicket-4109.patch
        7 kB
        Sven Meier

        Activity

        Hide
        Sven Meier added a comment -

        PageProvider no longer pushes PageParameters into previously stored pages.

        Show
        Sven Meier added a comment - PageProvider no longer pushes PageParameters into previously stored pages.
        Hide
        Martin Grigorov added a comment -

        Yes, I think the patch is correct.
        I also confirm that wicketstuff issue 64 is solved with it.

        Show
        Martin Grigorov added a comment - Yes, I think the patch is correct. I also confirm that wicketstuff issue 64 is solved with it.
        Hide
        Sven Meier added a comment -

        The attached path removes overwriteWith() for stored pages. Note the adjusted tests, the changes look a bit scary but I think they are correct: when a stored page is retrieved, its page parameters are not changed.

        Martin, can you confirm my findings? Thanks.

        Show
        Sven Meier added a comment - The attached path removes overwriteWith() for stored pages. Note the adjusted tests, the changes look a bit scary but I think they are correct: when a stored page is retrieved, its page parameters are not changed. Martin, can you confirm my findings? Thanks.
        Hide
        Sven Meier added a comment -

        Patch removing overwriteWith() for stored pages with adjusted tests.

        Show
        Sven Meier added a comment - Patch removing overwriteWith() for stored pages with adjusted tests.
        Hide
        Martin Grigorov added a comment -

        Good catch, Sven!

        This seems to be also the problem of https://github.com/wicketstuff/core/issues/64.

        This override was there before the recent refactor but maybe it wasn't used in all cases.

        Show
        Martin Grigorov added a comment - Good catch, Sven! This seems to be also the problem of https://github.com/wicketstuff/core/issues/64 . This override was there before the recent refactor but maybe it wasn't used in all cases.
        Hide
        Sven Meier added a comment -

        IMHO PageProvider#getStoredPage(int) is the culprit:

        if (pageParameters != null)

        { storedPageInstance.getPageParameters().overwriteWith(pageParameters); }

        This code writes the autocomplete query parameter "q" into the page's original parameters, although it was never involved in the creation of the page. In the following the page's url is always appended with "q=...".

        I'm not sure why this 'overwriteWith' is called here at all. WDYT?

        Show
        Sven Meier added a comment - IMHO PageProvider#getStoredPage(int) is the culprit: if (pageParameters != null) { storedPageInstance.getPageParameters().overwriteWith(pageParameters); } This code writes the autocomplete query parameter "q" into the page's original parameters, although it was never involved in the creation of the page. In the following the page's url is always appended with "q=...". I'm not sure why this 'overwriteWith' is called here at all. WDYT?
        Hide
        Stefan Mandel added a comment -

        a quickstart to reproduce the problem.

        Show
        Stefan Mandel added a comment - a quickstart to reproduce the problem.

          People

          • Assignee:
            Sven Meier
            Reporter:
            Stefan Mandel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development