diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-06-18 18:11:04 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-06-24 16:58:15 +0200 |
commit | ac2263d64c18832de34ad71e37e07ba26929d6a7 (patch) | |
tree | ced48398a66dcea093adf88dfd5d1e48961a9dbe /install | |
parent | 91a5d3349be3a8c6044684405a4e66f4ed1dd543 (diff) | |
download | freeipa-ac2263d64c18832de34ad71e37e07ba26929d6a7.tar.gz freeipa-ac2263d64c18832de34ad71e37e07ba26929d6a7.tar.xz freeipa-ac2263d64c18832de34ad71e37e07ba26929d6a7.zip |
Fix default value selection in radio widget
https://fedorahosted.org/freeipa/ticket/3718
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/src/freeipa/widget.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 4570c903..53e5ae60 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -666,6 +666,7 @@ IPA.option_widget_base = function(spec, that) { that.value_changed = that.value_changed || IPA.observer(); that.updated = that.updated || IPA.observer(); that.default_value = spec.default_value || null; + that.default_on_empty = spec.default_on_empty === undefined ? true : spec.default_on_empty; /** * Jquery reference to current node @@ -959,9 +960,18 @@ IPA.option_widget_base = function(spec, that) { if (values && values.length > 0) { + + if (that.default_on_empty && that.default_value !== null) { + for (var i=0; i<values.length; i++) { + if (values[i] === '') { + values[i] = that.default_value; + } + } + } + // check the option when option or some of its child should be // checked - for (var i=0; i<that.options.length; i++) { + for (i=0; i<that.options.length; i++) { var option = that.options[i]; var opt_vals = that.get_values(option); var has_opt = array.some(values, function(val) { |