You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2015/10/06 00:31:41 UTC

wicket git commit: WICKET-5993 change type attribute when submit only

Repository: wicket
Updated Branches:
  refs/heads/wicket-7.x 82c1df01f -> e5e2cdade


WICKET-5993 change type attribute when submit only


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

Branch: refs/heads/wicket-7.x
Commit: e5e2cdade107d3afb843981791eccc4ea5b9e230
Parents: 82c1df0
Author: Sven Meier <sv...@apache.org>
Authored: Tue Oct 6 00:30:05 2015 +0200
Committer: Sven Meier <sv...@apache.org>
Committed: Tue Oct 6 00:30:25 2015 +0200

----------------------------------------------------------------------
 .../java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java | 4 +++-
 .../org/apache/wicket/ajax/markup/html/form/AjaxButtonTest.java  | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/e5e2cdad/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
index caa7e39..85201f7 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java
@@ -169,7 +169,9 @@ public abstract class AjaxButton extends Button
 	protected void onComponentTag(ComponentTag tag)
 	{
 		// WICKET-5594 prevent non-Ajax submit
-		tag.put("type", "button");
+		if ("submit".equals(tag.getAttribute("type"))) {
+			tag.put("type", "button");
+		}
 
 		super.onComponentTag(tag);
 	}

http://git-wip-us.apache.org/repos/asf/wicket/blob/e5e2cdad/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/form/AjaxButtonTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/form/AjaxButtonTest.java b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/form/AjaxButtonTest.java
index 18bd35a..91ae973 100644
--- a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/form/AjaxButtonTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/form/AjaxButtonTest.java
@@ -34,6 +34,8 @@ public class AjaxButtonTest extends WicketTestCase
 		tester.startPage(HomePage.class);
 		// assert rendered page class
 		tester.assertRenderedPage(HomePage.class);
+		// assert button type unmodified, WICKET-5993W
+		assertEquals("image", tester.getTagById("cancel3").getAttribute("type"));
 		// assert button type for AjaxButtons, WICKET-5594
 		assertEquals("button", tester.getTagById("submit2").getAttribute("type"));
 		// assert rendered label component