diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2013-11-20 21:32:35 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2013-11-26 11:42:50 +0100 |
commit | 92d42a3c00836ba5f74fa829bcedd595614d6f3e (patch) | |
tree | 29540a783f5950c3b79d6d58993a39d50835a0d5 /framework | |
parent | 60c5c81b837d828654498750b52882ce0448c1b9 (diff) |
Fixed DefaultButton
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/Javascripts/source/prado/controls/controls.js | 18 |
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(); } } } |