From cf0792cd6479984a3c1377c34f047a5181535c0b Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 17 Mar 2017 10:55:06 +0000 Subject: [PATCH] More events from the property_field widgets to inform the enclosing form of the state changes. SVN:trunk[4598] --- js/property_field.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/js/property_field.js b/js/property_field.js index 64c4841136..26ebc1bd6a 100644 --- a/js/property_field.js +++ b/js/property_field.js @@ -97,6 +97,7 @@ $(function() if (this._equals(new_value, this.value)) { this.bModified = false; + this._notify_as_clean(true); } else { @@ -105,6 +106,10 @@ $(function() { this._do_apply(); } + else + { + this._notify_as_dirty(); + } } this._refresh(); if (this.options.parent_selector) @@ -112,6 +117,14 @@ $(function() $(this.options.parent_selector).trigger('subitem_changed'); } }, + _notify_as_dirty: function() + { + this.element.closest('form').trigger('property_field_dirty', { id: this.options.field_id, reason: 'modified' }); + }, + _notify_as_clean: function(bRevert) + { + this.element.closest('form').trigger('property_field_clean', { id: this.options.field_id, reason: (bRevert ? 'revert' : 'apply') }); + }, _equals: function( value1, value2 ) { if (this.options.equals === null) @@ -142,6 +155,10 @@ $(function() return this.options.get_field_value(); } }, + get_field_value: function() + { + return this._get_field_value(); + }, get_field_name: function() { return $('#'+this.options.field_id, this.element).attr('name'); @@ -186,6 +203,7 @@ $(function() this._refresh(); } } + this._notify_as_clean(false); }, _do_cancel: function() { @@ -221,6 +239,7 @@ $(function() $(this.options.parent_selector).trigger('subitem_changed'); } } + this._notify_as_clean(true); }, _do_submit: function() {