diff options
Diffstat (limited to 'framework/Web/Javascripts')
-rw-r--r-- | framework/Web/Javascripts/base/prado.js | 21 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/base.js | 17 |
2 files changed, 38 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/base/prado.js b/framework/Web/Javascripts/base/prado.js index 81f51e41..b1e87634 100644 --- a/framework/Web/Javascripts/base/prado.js +++ b/framework/Web/Javascripts/base/prado.js @@ -1,3 +1,24 @@ Prado = Class.create();
Prado.version = '3.0a';
+
+Prado.DefaultButton = Class.create();
+
+Prado.DefaultButton.buttonFired = false;
+Prado.DefaultButton.fire = function(event, target)
+{
+ if (!Prado.DefaultButton.buttonFired && event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea")))
+ {
+ var defaultButton = document.getElementById ? document.getElementById(target) : document.all[target];
+ if (defaultButton && typeof(defaultButton.click) != "undefined")
+ {
+ Prado.DefaultButton.buttonFired = true;
+ defaultButton.click();
+ event.cancelBubble = true;
+ if (event.stopPropagation)
+ event.stopPropagation();
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/framework/Web/Javascripts/js/base.js b/framework/Web/Javascripts/js/base.js index d16db163..1f86b1c1 100644 --- a/framework/Web/Javascripts/js/base.js +++ b/framework/Web/Javascripts/js/base.js @@ -841,6 +841,23 @@ return _7; Prado=Class.create(); Prado.version="3.0a"; +Prado.DefaultButton=Class.create(); +Prado.DefaultButton.buttonFired=false; +Prado.DefaultButton.fire=function(_1,_2){ +if(!Prado.DefaultButton.buttonFired&&_1.keyCode==13&&!(_1.srcElement&&(_1.srcElement.tagName.toLowerCase()=="textarea"))){ +var _3=document.getElementById?document.getElementById(_2):document.all[_2]; +if(_3&&typeof (_3.click)!="undefined"){ +Prado.DefaultButton.buttonFired=true; +_3.click(); +_1.cancelBubble=true; +if(_1.stopPropagation){ +_1.stopPropagation(); +} +return false; +} +} +return true; +}; Prado.doPostBack=function(_1,_2,_3,_4,_5,_6,_7,_8){ if(typeof (_4)=="undefined"){ |