Hedera.Shelves = new Class ({ Extends: Hedera.Form ,activate: function () { this.$('date').value = new Date (); this.$('useIds').value = false; } ,onConfigChange: function () { var fields = [ 'realm' ,'family' ,'warehouse' ,'shelf' ,'namePrefix' ,'maxAmount' ,'reportTitle' ,'showPacking' ,'stack' ]; for (var i = 0; i < fields.length; i++) this.$(fields[i]).value = this.$('config').get (fields[i]); } ,onPreviewClick: function () { var fields = [ 'family' ,'warehouse' ,'shelf' ,'namePrefix' ,'maxAmount' ,'reportTitle' ,'showPacking' ,'stack' ,'useIds' ,'date' ]; var batch = new Sql.Batch (); for (var i = 0; i < fields.length; i++) batch.addValue (fields[i], this.$(fields[i]).value); this.gui.openReport ('shelves-report', batch); } });