From 74857a8ee465819b262c3445ea22119196e92c5e Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 9 Jan 2012 10:56:24 +0100 Subject: 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 --- install/ui/widget.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'install/ui/widget.js') 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]; }; -- cgit