add error handling in listmap, improve setting the error class in inputs and arrayinputs
This commit is contained in:
parent
a5a833f3c1
commit
bbef38f0a9
3 changed files with 112 additions and 72 deletions
|
|
@ -1,3 +1,7 @@
|
|||
/*@
|
||||
Ox.ArrayInput <f> Array input
|
||||
@*/
|
||||
|
||||
Ox.ArrayInput = function(options, self) {
|
||||
|
||||
self = self || {};
|
||||
|
|
@ -141,7 +145,6 @@ Ox.ArrayInput = function(options, self) {
|
|||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'value') {
|
||||
Ox.print('--value--', value, self.$input)
|
||||
if (self.options.value.length == 0) {
|
||||
self.options.value = [''];
|
||||
}
|
||||
|
|
@ -156,6 +159,12 @@ Ox.ArrayInput = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
that.setErrors = function(values) {
|
||||
self.$input.forEach(function($input) {
|
||||
values.indexOf($input.value()) > -1 && $input.addClass('OxError');
|
||||
});
|
||||
};
|
||||
|
||||
// fixme: can't we generally use options.value for this?
|
||||
that.value = function() {
|
||||
if (arguments.length == 0) {
|
||||
|
|
|
|||
|
|
@ -810,6 +810,7 @@ Ox.Input = function(options, self) {
|
|||
self.options.value = self.options.value.toFixed(self.options.decimals);
|
||||
}
|
||||
self.$input.val(self.options.value);
|
||||
that.is('.OxError') && that.removeClass('OxError');
|
||||
setPlaceholder();
|
||||
} else if (key == 'width') {
|
||||
that.css({width: self.options.width + 'px'});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue