1
0
Fork 0
forked from 0x2620/oxjs

updates to url controller, filter and form elements

This commit is contained in:
rlx 2011-11-10 19:52:26 +00:00
commit 07c79ed7ac
7 changed files with 162 additions and 79 deletions

View file

@ -24,6 +24,7 @@ Ox.FormElementGroup = function(options, self) {
id: '',
elements: [],
float: 'left',
joinValues: null,
separators: [],
width: 0
})
@ -32,7 +33,7 @@ Ox.FormElementGroup = function(options, self) {
(
self.options.float == 'left' ?
self.options.elements : self.options.elements.reverse()
self.options.elements : Ox.clone(self.options.elements).reverse()
).forEach(function($element, i) {
$element.css({
float: self.options.float // fixme: make this a class
@ -41,6 +42,9 @@ Ox.FormElementGroup = function(options, self) {
autovalidate: function(data) {
that.triggerEvent({autovalidate: data});
},
change: function(data) {
that.triggerEvent({change: {value: that.value()}});
},
validate: function(data) {
that.triggerEvent({validate: data});
}
@ -78,13 +82,16 @@ Ox.FormElementGroup = function(options, self) {
};
that.value = function() {
return self.options.elements.map(function(element) {
var values = self.options.elements.map(function(element) {
var ret = null;
['checked', 'selected', 'value'].forEach(function(v) {
element[v] && (ret = element[v]());
});
return ret;
});
return self.options.joinValues
? self.options.joinValues(values)
: values;
};
return that;