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 Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.1
    • Fix Version/s: 4.3.4
    • Component/s: Panels
    • Labels:
      None
    • Environment:
      Generic
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      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; }
      1. diff.txt
        3 kB
        Kshitiz Saxena
      2. diff1.txt
        3 kB
        Kshitiz Saxena

        Issue Links

          Activity

          Hide
          Julien Ponge added a comment -

          Formatting broke your patch. Could you please upload it as an attachment?

          Show
          Julien Ponge added a comment - Formatting broke your patch. Could you please upload it as an attachment?
          Hide
          Kshitiz Saxena added a comment -

          Fix for issue 602, 603

          Show
          Kshitiz Saxena added a comment - Fix for issue 602, 603
          Hide
          Julien Ponge added a comment -

          The patch does not apply on the Git master branch.

          Show
          Julien Ponge added a comment - The patch does not apply on the Git master branch.
          Hide
          Kshitiz Saxena added a comment -

          Latest code diff with 4.3 source trunk

          Show
          Kshitiz Saxena added a comment - Latest code diff with 4.3 source trunk
          Hide
          Julien Ponge added a comment -

          Sorry, it does not apply against the current Git master. I should have mentioned this, as we are not going to do any further release on the 4.3 code branch.

          Show
          Julien Ponge added a comment - Sorry, it does not apply against the current Git master. I should have mentioned this, as we are not going to do any further release on the 4.3 code branch.

            People

            • Assignee:
              Julien Ponge
              Reporter:
              Kshitiz Saxena
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: