add option to Ox.Input to set readonly attribute
This commit is contained in:
parent
747128bdea
commit
46d0dcf2e3
2 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -50,6 +50,7 @@ Ox.Input <f> Input Element
|
|||
<a> array of image urls
|
||||
//trackStep <n> number, 0 for 'scroll here', positive for step
|
||||
trackValues <b> boolean
|
||||
readonly <b> if true, is readonly
|
||||
serialize <f> function used to serialize value in submit
|
||||
style <s> 'rounded' or 'square'
|
||||
textAlign <s> '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(
|
||||
|
|
Loading…
Reference in a new issue