From 92d42a3c00836ba5f74fa829bcedd595614d6f3e Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 20 Nov 2013 21:32:35 +0100 Subject: Fixed DefaultButton --- .../Web/Javascripts/source/prado/controls/controls.js | 18 +++++++++--------- 1 file 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(); } } } -- cgit v1.2.3