// setup namespace Zymonic.FieldFillCalculation = {}; // base form format // don't do anything here, makes it easy to establish inheritance Zymonic.FieldFillCalculation.FieldFillCalculation = function() {}; // init function Zymonic.FieldFillCalculation.FieldFillCalculation.prototype.init = function(args) { for (var key in args) { this[key] = args[key]; } if (this.ident != "") { Zymonic.add_to_lookup('FieldFillCalculation', this.ident, this); } if (this.parent_field) { this.parent_field.addFieldFillCalculation(this); // do this after a small timeout to allow everything load up // had tried to use event handlers for this but ended up being too complex var ffc = this; setTimeout(function(){ ffc.bindHandlers(); }, 1); } }; // binds all handlers needed to trigger this field fill Zymonic.FieldFillCalculation.FieldFillCalculation.prototype.bindHandlers = function() { if (this.parent_field) { // add change handlers to all dependent fields to trigger the checking of value on parent field // checking value on parent field will trigger this field fill calculation var self = this; var dependent_fields = this.getDependentFields(); for (var i=0; i