@@ -1325,7 +1325,7 @@ protected void delegateSubmit(IFormSubmitter submittingComponent)
1325
1325
// collect all forms innermost to outermost before any hierarchy is changed
1326
1326
final List <Form <?>> forms = Generics .newArrayList (3 );
1327
1327
visitFormsPostOrder (processingForm , (form , visit ) -> {
1328
- if (form .isSubmitted ())
1328
+ if (form .isVisibleInHierarchy () && form . isEnabledInHierarchy ())
1329
1329
{
1330
1330
forms .add (form );
1331
1331
}
@@ -1557,22 +1557,9 @@ public void component(final FormComponent<?> formComponent, IVisit<Void> visit)
1557
1557
* Mark each form component on this form and on nested forms valid.
1558
1558
*/
1559
1559
protected final void markFormComponentsValid ()
1560
- {
1561
- markNestedFormComponentsValid ();
1562
- internalMarkFormComponentsValid ();
1563
- }
1564
-
1565
- /**
1566
- * Mark each form component on nested form valid.
1567
- */
1568
- private void markNestedFormComponentsValid ()
1569
1560
{
1570
1561
visitFormsPostOrder (this , (form , visit ) -> {
1571
- if (form == Form .this )
1572
- {
1573
- return ;
1574
- }
1575
- if (form .isSubmitted ())
1562
+ if (form .isVisibleInHierarchy () && form .isEnabledInHierarchy ())
1576
1563
{
1577
1564
form .internalMarkFormComponentsValid ();
1578
1565
}
@@ -1879,24 +1866,9 @@ protected void onSubmit()
1879
1866
* @see org.apache.wicket.markup.html.form.FormComponent#updateModel()
1880
1867
*/
1881
1868
protected final void updateFormComponentModels ()
1882
- {
1883
- updateNestedFormComponentModels ();
1884
- internalUpdateFormComponentModels ();
1885
- }
1886
-
1887
- /**
1888
- * Update the model of all components on nested forms.
1889
- *
1890
- * @see #updateFormComponentModels()
1891
- */
1892
- private void updateNestedFormComponentModels ()
1893
1869
{
1894
1870
visitFormsPostOrder (this , (form , visit ) -> {
1895
- if (form == Form .this )
1896
- {
1897
- return ;
1898
- }
1899
- if (form .isSubmitted ())
1871
+ if (form .isVisibleInHierarchy () && form .isEnabledInHierarchy ())
1900
1872
{
1901
1873
form .internalUpdateFormComponentModels ();
1902
1874
}
@@ -1924,14 +1896,15 @@ private void internalUpdateFormComponentModels()
1924
1896
*/
1925
1897
protected final void validate ()
1926
1898
{
1927
- // since this method can be called directly by users, this additional check is needed
1928
- if (isEnabledInHierarchy () && isVisibleInHierarchy ())
1929
- {
1930
- validateNestedForms ();
1931
- validateComponents ();
1932
- validateFormValidators ();
1933
- onValidate ();
1934
- }
1899
+ visitFormsPostOrder (this , (form , visit ) -> {
1900
+ // since this method can be called directly by users, this additional check is needed
1901
+ if (form .isVisibleInHierarchy () && form .isEnabledInHierarchy ())
1902
+ {
1903
+ form .validateComponents ();
1904
+ form .validateFormValidators ();
1905
+ form .onValidate ();
1906
+ }
1907
+ });
1935
1908
}
1936
1909
1937
1910
/**
@@ -1949,16 +1922,11 @@ protected void onValidate()
1949
1922
private void internalOnValidateModelObjects ()
1950
1923
{
1951
1924
visitFormsPostOrder (this , (form , visit ) -> {
1952
- if (form == Form .this )
1953
- {
1954
- return ;
1955
- }
1956
- if (form .isSubmitted ())
1925
+ if (form .isVisibleInHierarchy () && form .isEnabledInHierarchy ())
1957
1926
{
1958
1927
form .onValidateModelObjects ();
1959
1928
}
1960
1929
});
1961
- onValidateModelObjects ();
1962
1930
}
1963
1931
1964
1932
/**
@@ -2055,28 +2023,6 @@ protected final void validateFormValidators()
2055
2023
}
2056
2024
}
2057
2025
2058
- /**
2059
- * Validates {@link FormComponent}s as well as {@link IFormValidator}s in nested {@link Form}s.
2060
- *
2061
- * @see #validate()
2062
- */
2063
- private void validateNestedForms ()
2064
- {
2065
- visitFormsPostOrder (this , (form , visit ) -> {
2066
- if (form == Form .this )
2067
- {
2068
- return ;
2069
- }
2070
-
2071
- if (form .isSubmitted ())
2072
- {
2073
- form .validateComponents ();
2074
- form .validateFormValidators ();
2075
- form .onValidate ();
2076
- }
2077
- });
2078
- }
2079
-
2080
2026
/**
2081
2027
* Allows to customize input names of form components inside this form.
2082
2028
*
0 commit comments