You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/08/12 11:03:46 UTC

git commit: WICKET-5672 Form#findSubmittingComponent() should not throw exceptions if the submitter is disabled/invisible

Repository: wicket
Updated Branches:
  refs/heads/master 3b661b5cb -> d20e568b5


WICKET-5672 Form#findSubmittingComponent() should not throw exceptions if the submitter is disabled/invisible


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d20e568b
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d20e568b
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d20e568b

Branch: refs/heads/master
Commit: d20e568b51f9c8e4612472d143df4d49a3bd0e63
Parents: 3b661b5
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Aug 12 11:03:24 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Aug 12 11:03:24 2014 +0200

----------------------------------------------------------------------
 .../apache/wicket/markup/html/form/Form.java    | 32 ++++++++++++--------
 1 file changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/d20e568b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
index c27d3c5..5a5bd63 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
@@ -442,18 +442,6 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener,
 						if ((!parameters.getParameterValue(name).isNull())
 							|| !parameters.getParameterValue(name + ".x").isNull())
 						{
-							if (!component.isVisibleInHierarchy())
-							{
-								throw new WicketRuntimeException("Submit Button "
-									+ submittingComponent.getInputName() + " (path="
-									+ component.getPageRelativePath() + ") is not visible");
-							}
-							if (!component.isEnabledInHierarchy())
-							{
-								throw new WicketRuntimeException("Submit Button "
-									+ submittingComponent.getInputName() + " (path="
-									+ component.getPageRelativePath() + ") is not enabled");
-							}
 							visit.stop(submittingComponent);
 						}
 					}
@@ -745,6 +733,26 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener,
 				if (submitter == null)
 				{
 					submitter = findSubmittingButton();
+
+					if (submitter instanceof IFormSubmittingComponent)
+					{
+						IFormSubmittingComponent submittingComponent = (IFormSubmittingComponent) submitter;
+						Component component = (Component) submitter;
+
+						if (!component.isVisibleInHierarchy())
+						{
+							throw new WicketRuntimeException("Submit Button " +
+								submittingComponent.getInputName() + " (path=" +
+								component.getPageRelativePath() + ") is not visible");
+						}
+
+						if (!component.isEnabledInHierarchy())
+						{
+							throw new WicketRuntimeException("Submit Button " +
+								submittingComponent.getInputName() + " (path=" +
+								component.getPageRelativePath() + ") is not enabled");
+						}
+					}
 				}
 
 				// When processing was triggered by a Wicket IFormSubmittingComponent and that