Wicket
  1. Wicket
  2. WICKET-4290

Confusion between a form component's wicket:id and a PageParameter in Wicket 1.5.x

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0, 1.5.1, 1.5.2, 1.5.3
    • Fix Version/s: 1.5.4, 6.0.0-beta1
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      OS Linux Mint
      Java 1.6

      Description

      A Form has a strange behavior when a component has the same wicket:id than a page parameter.

      To create a Bookmarkable link after a form is submited, setResponsePage is called, and a PageParameter object is given as a parameter :
      PageParameters params = new PageParameters();
      params.add("searchString", searchField.getValue());
      setResponsePage(SomePage.class, params);

      In Wicket 1.5, if "searchString" is also a form-component's wicket:id, the form will only be submitted once :
      searchField.getValue() will always return the first value entered by the user.

      Here's an example :

      public class SearchPanel extends Panel {

      public SearchPanel(String id)

      { super(id); add(new SearchForm("searchForm")); }

      private class SearchForm extends Form<String> {

      private static final long serialVersionUID = 1L;
      private TextField<String> searchField;

      public SearchForm(String id)

      { super(id); searchField = new TextField<String>("searchString", new Model<String>("")); add(searchField); }

      @Override
      public void onSubmit()

      { PageParameters params = new PageParameters(); params.add("searchString", searchField.getValue()); setResponsePage(ListContactsPage.class, params); }

      }
      }

      I tested the same application with Wicket 1.4.17 and it was fine. I only had this problem in Wicket 1.5.2 and 1.5.3.

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Emond Papegaaij
              Reporter:
              Victor MONTANER
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development