Details
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; }
Issue Links
- is duplicated by
-
IZPACK-603
UserInputPanel: inputs should not be validated when panel is reloaded due to checkbox/radiobutton having revalidate="yes" in their spec
-
Formatting broke your patch. Could you please upload it as an attachment?