Commit bbe0bfb7 authored by Romain Courteaud's avatar Romain Courteaud

Catch submit event on top gadget.

This should prevent the browser to handle form submit (and so, prevent changing browser URL).
parent f6f865af
...@@ -119,6 +119,7 @@ ...@@ -119,6 +119,7 @@
<script src="URI.js" type="text/javascript"></script>\n <script src="URI.js" type="text/javascript"></script>\n
<script src="jquery.js" type="text/javascript"></script>\n <script src="jquery.js" type="text/javascript"></script>\n
<script src="jquerymobile.js"> type="text/javascript"></script>\n <script src="jquerymobile.js"> type="text/javascript"></script>\n
<script src="gadget_global.js" type="text/javascript"></script>\n
<script src="gadget_erp5.js" type="text/javascript"></script>\n <script src="gadget_erp5.js" type="text/javascript"></script>\n
\n \n
<script id="panel-template" type="text/x-handlebars-template">\n <script id="panel-template" type="text/x-handlebars-template">\n
...@@ -283,7 +284,7 @@ ...@@ -283,7 +284,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>937.59751.29793.48025</string> </value> <value> <string>937.64343.1806.54016</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -301,7 +302,7 @@ ...@@ -301,7 +302,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1412251612.53</float> <float>1412343671.79</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -101,9 +101,9 @@ ...@@ -101,9 +101,9 @@
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
/*global window, rJS, RSVP, jQuery, console, jQuery, XMLHttpRequest */\n /*global window, document, rJS, RSVP, jQuery, console, jQuery, XMLHttpRequest, loopEventListener */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n /*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, rJS, RSVP, $, XMLHttpRequest, console) {\n (function (window, document, rJS, RSVP, $, XMLHttpRequest, console, loopEventListener) {\n
"use strict";\n "use strict";\n
\n \n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -411,9 +411,28 @@ ...@@ -411,9 +411,28 @@
.push(undefined, function (error) {\n .push(undefined, function (error) {\n
return displayError(gadget, error);\n return displayError(gadget, error);\n
});\n });\n
})\n
\n
.declareService(function () {\n
////////////////////////////////////\n
// Form submit listening. Prevent browser to automatically handle the form submit in case of a bug\n
////////////////////////////////////\n
var gadget = this;\n
\n
function catchFormSubmit() {\n
return displayError(new Error("Unexpected form submit"));\n
}\n
\n
// Listen to form submit\n
return loopEventListener(\n
gadget.props.element,\n
\'submit\',\n
false,\n
catchFormSubmit\n
);\n
});\n });\n
\n \n
}(window, rJS, RSVP, jQuery, XMLHttpRequest, console)); }(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener));
]]></string> </value> ]]></string> </value>
</item> </item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment