From 1e4d9808339e6c8c9adf36839d3cff4cdab05e28 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 3 Nov 2013 17:59:19 +0100 Subject: Fixed TImageButton, TActiveImageButton --- .../source/prado/activecontrols/activecontrols3.js | 16 +++---- .../source/prado/activecontrols/ajax3.js | 2 +- .../Javascripts/source/prado/controls/controls.js | 51 ++++++++++------------ 3 files changed, 33 insertions(+), 36 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js index 8f1fd3b8..de1ac3bf 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js @@ -24,11 +24,11 @@ Prado.WebUI.TActiveImageButton = jQuery.klass(Prado.WebUI.TImageButton, { onPostBack : function(options, event) { - this.addXYInput(event,options); + this.addXYInput(options, event); var request = new Prado.CallbackRequest(options.EventTarget, options); request.dispatch(); - event.stopPropagation(); - this.removeXYInput(event,options); + event.preventDefault(); + this.removeXYInput(options, event); } }); /** @@ -40,7 +40,7 @@ Prado.WebUI.TActiveCheckBox = jQuery.klass(Prado.WebUI.CallbackControl, { var request = new Prado.CallbackRequest(options.EventTarget, options); if(request.dispatch()==false) - event.stopPropagation(); + event.preventDefault(); } }); @@ -88,7 +88,7 @@ Prado.WebUI.TActiveTextBox = jQuery.klass(Prado.WebUI.TTextBox, var request = new Prado.CallbackRequest(options.EventTarget, options); request.dispatch(); if (!Prototype.Browser.IE) - event.stopPropagation(); + event.preventDefault(); } }); @@ -278,7 +278,7 @@ Prado.WebUI.ActiveListControl = jQuery.klass(Prado.WebUI.Control, { var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); request.dispatch(); - event.stopPropagation(); + event.preventDefault(); } }); @@ -321,7 +321,7 @@ Prado.WebUI.TEventTriggeredCallback = jQuery.klass(Prado.WebUI.Control, var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); request.dispatch(); if(this.options.StopEvent == true) - event.stopPropagation(); + event.preventDefault(); } }); @@ -421,7 +421,7 @@ Prado.WebUI.TActiveRatingList = jQuery.klass(Prado.WebUI.TRatingList, },this.options); var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions); if(request.dispatch()==false) - ev.stopPropagation(); + ev.preventDefault(); } }); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js index 68b4a8be..4e368bf4 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js @@ -196,7 +196,7 @@ Prado.CallbackRequest = jQuery.klass(Prado.PostBack, if(this.options['CausesValidation'] && typeof(Prado.Validation) != "undefined") { - if(!Prado.Validation.validate(this.getForm(), this.options['ValidationGroup'], this)) + if(!Prado.Validation.validate(this.getForm().id, this.options['ValidationGroup'], this)) return false; } diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js index 8914db3c..ec0b1cab 100644 --- a/framework/Web/Javascripts/source/prado/controls/controls.js +++ b/framework/Web/Javascripts/source/prado/controls/controls.js @@ -304,33 +304,30 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl, */ addXYInput : function(event,options) { - var imagePos = this.element.cumulativeOffset(); + var imagePos = jQuery(this.element).offset(); var clickedPos = [event.clientX, event.clientY]; - var x = clickedPos[0]-imagePos[0]+1; - var y = clickedPos[1]-imagePos[1]+1; + var x = clickedPos[0]-imagePos['left']+1; + var y = clickedPos[1]-imagePos['top']+1; x = x < 0 ? 0 : x; y = y < 0 ? 0 : y; - var id = options['EventTarget']; - var x_input = $(id+"_x"); - var y_input = $(id+"_y"); - if(x_input) - { - x_input.value = x; - } - else - { - x_input = INPUT({type:'hidden',name:id+'_x','id':id+'_x',value:x}); - this.element.parentNode.appendChild(x_input); - } - if(y_input) - { - y_input.value = y; - } - else - { - y_input = INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y}); - this.element.parentNode.appendChild(y_input); - } + var id = this.element.id; + var name = options['EventTarget']; + var form = this.element.form; + + var input=null; + input = document.createElement("input"); + input.setAttribute("type", "hidden"); + input.setAttribute("id", id+"_x"); + input.setAttribute("name", name+"_x"); + input.setAttribute("value", x); + form.appendChild(input); + + input = document.createElement("input"); + input.setAttribute("type", "hidden"); + input.setAttribute("id", id+"_y"); + input.setAttribute("name", name+"_y"); + input.setAttribute("value", y); + form.appendChild(input); }, /** @@ -340,9 +337,9 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl, */ removeXYInput : function(event,options) { - var id = options['EventTarget']; - this.element.parentNode.removeChild($(id+"_x")); - this.element.parentNode.removeChild($(id+"_y")); + var id = this.element.id; + jQuery('#'+id+'_x').remove(); + jQuery('#'+id+'_y').remove(); } }); -- cgit v1.2.3