You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/08/25 23:29:15 UTC

svn commit: r989375 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket: ajax/wicket-ajax.js markup/html/wicket-event.js

Author: ivaynberg
Date: Wed Aug 25 21:29:14 2010
New Revision: 989375

URL: http://svn.apache.org/viewvc?rev=989375&view=rev
Log:

Issue: WICKET-1448

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=989375&r1=989374&r2=989375&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js Wed Aug 25 21:29:14 2010
@@ -1032,12 +1032,7 @@ Wicket.Ajax.Call.prototype = {
 	// Submits a form using ajax.
 	// This method serializes a form and sends it as POST body.
 	submitForm: function(form, submitButton) {
-	    if (typeof(form.onsubmit)=="function") {
-	    	var result=form.onsubmit();
-	    	if (typeof(result)=="boolean"&&result==false) {
-	    		return;
-	    	}
-	    }
+	    if (!Wicket.Event.fire(form, "submit")) return;
 	    
 	    if (this.handleMultipart(form, submitButton)) {
 	    	return true;

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js?rev=989375&r1=989374&r2=989375&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/wicket-event.js Wed Aug 25 21:29:14 2010
@@ -112,6 +112,16 @@ if (typeof(Wicket.Event) == "undefined")
 			original.bind(element)();
 		},
 	
+		fire: function(element, event) {
+			if (document.createEvent) {
+				var e=document.createEvent("Event");
+				e.initEvent(event, true, true);
+				return element.dispatchEvent(e);
+			} else {
+				return element.fireEvent("on"+event);
+			}
+		},
+		
 		// adds an event of specified type to the element
 		// also supports the domready event on window
 		// domready is event fired when the DOM is complete, but before loading external resources (images, ...)