papegaaij commented on code in PR #1033:
URL: https://github.com/apache/wicket/pull/1033#discussion_r2120274875


##########
wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java:
##########
@@ -2059,13 +2020,13 @@ protected final void validateFormValidator(final 
IFormValidator validator)
                                }
                                // check if the dependent component is visible 
and is attached to
                                // the page
-                               else if 
(!isFormComponentVisibleInPage(dependent))
+                               else if (!dependent.isVisibleInHierarchy() || 
!dependent.isEnabledInHierarchy() || !dependent.isFormParticipant())

Review Comment:
   IMHO an `IFormValidator` should be executed if at least one of the dependent 
components is enabled. It should not be necessary for all components to be 
enabled. We've been bitten by this problem as well.
   
   Suppose you have a form where you can enter a certain property in 2 ways. 
For example, a form where you can upload a certificate with private key, either 
in PKCS#12 format (1 single file) or in PEM format (2 files). You can toggle 
these fields via radio buttons, so only one of the 2 formats is visible at a 
given moment. In this form, there's also a field for the domain name, which 
needs to match with the provided certificate. The easiest way would be to have 
an `IFormValidator` with all these fields as dependent components. However, 
this does not work as either the PKCS#12 or the PEM fields are not visible, so 
your validator is never executed.
   
   A problem I do see is that disabled components do not participate in form 
processing, so their converted input is always null. Your validator needs to be 
able to deal with this properly. In the example above, this is not an issue, 
because the validator simply checks the state of the radio buttons before 
reading either the PKCS#12 or PEM fields.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to