From e1eb3feb497e72021ebea8a3322ab5d5038401fa Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 7 Oct 2011 18:42:35 +0200 Subject: [PATCH] fix a regression with regards to the disabled state of form elements (jquery 1.6 attr() has changed) --- source/Ox.UI/js/Form/Ox.Button.js | 17 ++++++++++------- source/Ox.UI/js/Form/Ox.Checkbox.js | 6 ++++++ source/Ox.UI/js/Form/Ox.Input.js | 15 +++++++++------ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/source/Ox.UI/js/Form/Ox.Button.js b/source/Ox.UI/js/Form/Ox.Button.js index 0c4ac14f..f4ab6ffb 100644 --- a/source/Ox.UI/js/Form/Ox.Button.js +++ b/source/Ox.UI/js/Form/Ox.Button.js @@ -43,10 +43,11 @@ Ox.Button = function(options, self) { width: 'auto' }) .options(options || {}) - .attr({ - disabled: self.options.disabled ? 'disabled' : '', + .attr(Ox.extend({ type: self.options.type == 'text' ? 'button' : 'image' - }) + }, self.options.disabled ? { + disabled: 'disabled' + } : {}) .addClass('OxButton Ox' + Ox.toTitleCase(self.options.size) + (self.options.disabled ? ' OxDisabled': '') + (self.options.selected ? ' OxSelected': '') + @@ -131,10 +132,12 @@ Ox.Button = function(options, self) { self.setOption = function(key, value) { if (key == 'disabled') { - that.attr({ - disabled: value ? 'disabled' : '' - }) - .toggleClass('OxDisabled'); + if (value) { + that.attr({disabled: 'disabled'}) + } else { + that.removeAttr('disabled'); + } + that.toggleClass('OxDisabled'); } else if (key == 'selected') { if (value != that.hasClass('OxSelected')) { // fixme: neccessary? that.toggleClass('OxSelected'); diff --git a/source/Ox.UI/js/Form/Ox.Checkbox.js b/source/Ox.UI/js/Form/Ox.Checkbox.js index ddee5cee..92a48e55 100644 --- a/source/Ox.UI/js/Form/Ox.Checkbox.js +++ b/source/Ox.UI/js/Form/Ox.Checkbox.js @@ -101,6 +101,12 @@ Ox.Checkbox = function(options, self) { self.setOption = function(key, value) { if (key == 'checked') { that.toggleChecked(); + } else if (key == 'disabled') { + if (value) { + that.attr({disabled: 'disabled'}) + } else { + that.removeAttr('disabled'); + } } else if (key == 'title') { self.$title.options({title: value}); } diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js index 002737c5..48e955d5 100644 --- a/source/Ox.UI/js/Form/Ox.Input.js +++ b/source/Ox.UI/js/Form/Ox.Input.js @@ -205,10 +205,11 @@ Ox.Input = function(options, self) { self.$input = $(self.options.type == 'textarea' ? '