diff --git a/install/ui/widget.js b/install/ui/widget.js index 3e31b4c4a..4dc2d5f81 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -141,6 +141,52 @@ IPA.widget = function(spec) { } } }; + /** + * This function compares the original values and the + * values entered in the UI. If the values have changed + * it will return true. + */ + that.test_dirty = function(){ + + if (that.read_only) { + return false; + } + + var values = that.save(); + + if (!values) { // ignore null values + return false; + } + + if (!that.values) { + + if (values instanceof Array) { + + if ((values.length === 0) || + (values.length === 1) && + (values[0] === '')) { + return false; + } + } + + return true; + } + + if (values.length != that.values.length) { + return true; + } + + values.sort(); + that.values.sort(); + + for (var i=0; i