summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2013-11-20 21:32:35 +0100
committerFabio Bas <ctrlaltca@gmail.com>2013-11-21 17:46:09 +0100
commit1f8a1f7381b76c4c2b43437ebc7e30100a4bb36d (patch)
tree0eea9080e4f642e09b7cc92d8bbfe44e6454d84a /framework
parent85ca63b0896be3d12a098b44b5ec0c65a5b76a6c (diff)
Fixed DefaultButton
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/Javascripts/source/prado/controls/controls.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js
index 619e924b..b4d5653e 100644
--- a/framework/Web/Javascripts/source/prado/controls/controls.js
+++ b/framework/Web/Javascripts/source/prado/controls/controls.js
@@ -413,24 +413,24 @@ Prado.WebUI.DefaultButton = jQuery.klass(Prado.WebUI.Control,
onInit : function(options)
{
this.options = options;
- this.observe(options['Panel'], "keydown", jQuery.proxy(this.triggerEvent,this));
+ this.observe(jQuery('#'+options['Panel']), "keydown", jQuery.proxy(this.triggerEvent,this));
},
- triggerEvent : function(ev, target)
+ triggerEvent : function(ev)
{
- var enterPressed = Event.keyCode(ev) == Event.KEY_RETURN;
- var isTextArea = Event.element(ev).tagName.toLowerCase() == "textarea";
- var isHyperLink = Event.element(ev).tagName.toLowerCase() == "a" && Event.element(ev).hasAttribute("href");
- var isValidButton = Event.element(ev).tagName.toLowerCase() == "input" && Event.element(ev).type.toLowerCase() == "submit";
+ var enterPressed = ev.keyCode == 13;
+ var isTextArea = ev.target.tagName.toLowerCase() == "textarea";
+ var isHyperLink = ev.target.tagName.toLowerCase() == "a" && ev.target.hasAttribute("href");
+ var isValidButton = ev.target.tagName.toLowerCase() == "input" && ev.target.type.toLowerCase() == "submit";
if(enterPressed && !isTextArea && !isValidButton && !isHyperLink)
{
- var defaultButton = $(this.options['Target']);
+ var defaultButton = $('#'+this.options['Target']);
if(defaultButton)
{
this.triggered = true;
- Event.fireEvent(defaultButton, this.options['Event']);
- Event.stop(ev);
+ defaultButton.trigger(this.options['Event']);
+ ev.preventDefault();
}
}
}