Uploaded image for project: 'IzPack'
  1. IzPack
  2. IZPACK-603

UserInputPanel: inputs should not be validated when panel is reloaded due to checkbox/radiobutton having revalidate="yes" in their spec

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 4.3.1
    • Fix Version/s: 4.3.4
    • Component/s: Panels
    • Labels:
      None
    • Environment:

      Generic

      Description

      Reload of panel calls all validator added to panel. Validator are executed even on reload, which should not be the case. Validator should only be executed when "next" button is clicked.

      Following changes in izpack-src-trunk/src/lib/com/izforge/izpack/panels/UserInputPanel.java helps avoid validation in case of panel reload.
      Variable "validating" already exists in code, however its usage has been commented out . I used it in few more places

      Index: UserInputPanel.java
      ===================================================================
      — UserInputPanel.java (revision 2817)
      +++ UserInputPanel.java (working copy)
      @@ -1196,7 +1196,7 @@
      try
      {
      FileInputField panel = (FileInputField) field.getComponent();

      • result = panel.validateField();
        + result = !validating || panel.validateField();
        if (result)
        {
        idata.setVariable(field.getAssociatedVariable(), panel.getSelectedFile()
        @@ -1221,7 +1221,7 @@
        try
        {
        FileInputField input = (FileInputField) field.getComponent();
      • result = input.validateField();
        + result = !validating || input.validateField();
        if (result)
        {
        idata.setVariable(field.getAssociatedVariable(), input.getSelectedFile()
        @@ -1246,7 +1246,7 @@
        try
        {
        MultipleFileInputField input = (MultipleFileInputField) field.getComponent();
      • result = input.validateField();
        + result = !validating || input.validateField();
        if (result)
        {
        List<String> files = input.getSelectedFiles();
        @@ -1834,7 +1834,7 @@

      // validate the input
      Debug.trace("Validating text field");

      • boolean success = textField.validateContents();
        + boolean success = !validating || textField.validateContents();
        if (!success)
        {
        Debug.trace("Validation did not pass, message: " + message);
        @@ -3909,7 +3909,11 @@
        // readInput();
        // panelActivate();
        // validating = true;
        + Debug.trace("Setting validating to false");
        + validating=false;
        updateDialog();
        + Debug.trace("Setting validating back to true");
        + validating=true;
        }

        Attachments

          Activity

            People

            • Assignee:
              julienponge Julien Ponge
              Reporter:
              kshitizsaxena Kshitiz Saxena (Inactive)
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: