diff --git a/source/UI/css/theme.css b/source/UI/css/theme.css index 4dbb390c..1536b780 100644 --- a/source/UI/css/theme.css +++ b/source/UI/css/theme.css @@ -588,7 +588,9 @@ Forms } .$themeClass input.OxCheckbox.OxDisabled, -.$themeClass input.OxInput:disabled { +.$themeClass input.OxInput:disabled, +.$themeClass input.OxInput[readonly=readonly], +.$themeClass textarea.OxInput[readonly=readonly] { background-image: -moz-linear-gradient(top, $inputDisabledGradient); background: -ms-linear-gradient(top, $inputDisabledGradient); background-image: -o-linear-gradient(top, $inputDisabledGradient); diff --git a/source/UI/js/Form/Input.js b/source/UI/js/Form/Input.js index 71c695e9..37e8297b 100644 --- a/source/UI/js/Form/Input.js +++ b/source/UI/js/Form/Input.js @@ -50,6 +50,7 @@ Ox.Input Input Element array of image urls //trackStep number, 0 for 'scroll here', positive for step trackValues boolean + readonly if true, is readonly serialize function used to serialize value in submit style 'rounded' or 'square' textAlign 'left', 'center' or 'right' @@ -103,6 +104,7 @@ Ox.Input = function(options, self) { labelWidth: 64, overlap: 'none', placeholder: '', + readonly: false, serialize: null, style: 'rounded', textAlign: 'left', @@ -139,6 +141,8 @@ Ox.Input = function(options, self) { }); } else if (key == 'placeholder') { setPlaceholder(); + } else if (key == 'readonly') { + self.$input.attr({readonly: value}); } else if (key == 'value') { if (self.options.type == 'float' && self.options.decimals) { self.options.value = self.options.value.toFixed(self.options.decimals); @@ -285,6 +289,7 @@ Ox.Input = function(options, self) { .addClass('OxInput OxKeyboardFocus OxMedium Ox' + Ox.toTitleCase(self.options.style)) .attr({ disabled: self.options.disabled, + readonly: self.options.readonly, type: self.options.type == 'password' ? 'password' : 'text' }) .css(