diff --git a/source/UI/js/Form/FormPanel.js b/source/UI/js/Form/FormPanel.js index 5b3da686..2770599d 100644 --- a/source/UI/js/Form/FormPanel.js +++ b/source/UI/js/Form/FormPanel.js @@ -69,7 +69,7 @@ Ox.FormPanel = function(options, self) { }), max: 1, min: 1, - selected: [self.options.selected], + selected: [self.options.section], sort: [{key: 'id', operator: '+'}], unique: 'id', width: self.options.listSize @@ -77,6 +77,9 @@ Ox.FormPanel = function(options, self) { select: function(data) { self.$sections[self.section].hide(); self.section = Ox.getIndexById(self.options.form, data.ids[0]); + if (self.section == -1) { + self.section = 0 + } self.$sections[self.section].show(); that.triggerEvent('select', {section: data.ids[0]}); } @@ -142,7 +145,7 @@ Ox.FormPanel = function(options, self) { function setSection() { var id = self.options.section, section = Ox.getIndexById(self.options.form, id); - if (self.section != section) { + if (section > -1 && self.section != section) { self.$sections[self.section].hide(); self.section = section; self.$list.options('selected', [id]); @@ -219,7 +222,7 @@ Ox.FormPanel = function(options, self) { var sections = arguments[0]; self.options.form.forEach(function(form, i) { - if ((form.id in sections) { + if (form.id in sections) { self.$forms[i].values(sections[form.id]); } });