diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-01-09 10:56:24 +0100 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2012-01-11 00:48:44 -0600 |
commit | 74857a8ee465819b262c3445ea22119196e92c5e (patch) | |
tree | 2626c2042c0b3a35a7032f8143ea19075dad1966 /install/ui/widget.js | |
parent | 05345ce8c8007dd3ef708ae9049423937d543c67 (diff) | |
download | freeipa.git-74857a8ee465819b262c3445ea22119196e92c5e.tar.gz freeipa.git-74857a8ee465819b262c3445ea22119196e92c5e.tar.xz freeipa.git-74857a8ee465819b262c3445ea22119196e92c5e.zip |
Added IP address validator to Host and DNS record adder dialog
Also fixed minor issues reagarding IP addresses or multivalued field:
- removed unnecessary method overrides from multivalued_field
- fixed extract_child_value method in multivalued_widget to return '' instead of empty arrays when value array is empty
- net.js - changed method name and error message from 'trailing zeros' to 'leading zeros'
https://fedorahosted.org/freeipa/ticket/1466
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r-- | install/ui/widget.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js index 9ae308ca..4972372c 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -406,8 +406,15 @@ IPA.multivalued_text_widget = function(spec) { that.extract_child_value = function(value) { - if (value.length) return value[0]; + if (value instanceof Array) { + if (value.length > 0) { + return value[0]; + } + return ''; + } + if (value) return value; + return ''; }; @@ -851,7 +858,14 @@ IPA.select_widget = function(spec) { }; that.save = function() { - var value = that.select.val() || ''; + var value; + + if (that.select) { + value = that.select.val() || ''; + } else if (that.options.length > 0) { + value = that.options[0].value; //will be default value + } + return [value]; }; |