summaryrefslogtreecommitdiffstats
path: root/install/ui/widget.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-03-09 15:52:05 +0100
committerPetr Vobornik <pvoborni@redhat.com>2012-03-15 16:08:02 +0100
commit3ca0f6aee5b04758f8473359cc14979d27d31530 (patch)
tree3d7b2ef8a65219e66e3f7155b1a06da5608c3f8b /install/ui/widget.js
parent51601ac794ce589981c0cc3501d91518cea27f15 (diff)
downloadfreeipa.git-3ca0f6aee5b04758f8473359cc14979d27d31530.tar.gz
freeipa.git-3ca0f6aee5b04758f8473359cc14979d27d31530.tar.xz
freeipa.git-3ca0f6aee5b04758f8473359cc14979d27d31530.zip
Fixed evaluating checkbox dirty status
Problem: When value in checkbox is modified twice in a row (so it is at its original value) an 'undo' button is still visible even when it shouldn't be. Cause: IPA server sends boolean values as 'TRUE' or 'FALSE' (strings). Checkbox_widget converts them to JavaScript? boolean (true, false). Save method in checkbox_widget is returning array with a boolean. So test_dirty method always evaluates to dirty because 'FALSE' != false. This patch is fixing the problem. https://fedorahosted.org/freeipa/ticket/2494
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r--install/ui/widget.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index d46bbd8a..4ddff81f 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -632,18 +632,12 @@ IPA.checkbox_widget = function (spec) {
var value;
if (values && values.length) {
- // use loaded value
value = values[0];
- } else {
- // use default value
- value = that.checked;
}
- // convert string into boolean
- if (value === 'TRUE') {
- value = true;
- } else if (value === 'FALSE') {
- value = false;
+ if (typeof value !== 'boolean') {
+ // use default value
+ value = that.checked;
}
that.input.attr('checked', value);