diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-01-29 23:03:30 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-01-30 15:32:59 -0500 |
commit | 987507efd03f946a21a6dd352855513e087f1c6e (patch) | |
tree | 0a7938ee04341172bb21efbd916ce93cf5b92f4a | |
parent | de28abc236625e48b6027c5229c56998a21bcc39 (diff) | |
download | freeipa-987507efd03f946a21a6dd352855513e087f1c6e.tar.gz freeipa-987507efd03f946a21a6dd352855513e087f1c6e.tar.xz freeipa-987507efd03f946a21a6dd352855513e087f1c6e.zip |
Fixed IPA.widget's load, save, and is_dirty.
This patch fixes the problem leaving the user details page.
-rw-r--r-- | install/ui/widget.js | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js index ad42e17b8..d856f50ec 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -109,9 +109,20 @@ IPA.widget = function(spec) { that.container = container; } + /** + * This function stores the entire record and the values + * of the field, then invoke reset() to update the UI. + */ function load(record) { that.record = record; - that.values = record[that.name]; + + var value = record[that.name]; + if (value instanceof Array) { + that.values = value; + } else { + that.values = value ? [value] : []; + } + that.reset(); } @@ -123,10 +134,20 @@ IPA.widget = function(spec) { function update() { } + /** + * This function saves the values entered in the UI. + * It returns the values in an array, or null if + * the field should not be saved. + */ function save() { - return []; + return that.values; } + /** + * This function compares the original values and the + * values entered in the UI. If the values have changed + * it will return true. + */ that.is_dirty = function() { if (that.read_only) { @@ -135,15 +156,11 @@ IPA.widget = function(spec) { var values = that.save(); - if (!that.values) { - - if (!values) { - return false; - } + if (!values) { // ignore null values + return false; + } - if (values === '') { - return false; - } + if (!that.values) { if (values instanceof Array) { |