diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2011-08-24 15:36:48 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-08-25 00:51:28 +0000 |
commit | a6cf44bd6538788a20fd6021b802443d4b0c63d9 (patch) | |
tree | 8d27f73864b7a572024f0762e95110d082d80e67 /install/ui/widget.js | |
parent | 5ba0be24e850fa924f8e36f579cfca3768607e4b (diff) | |
download | freeipa-a6cf44bd6538788a20fd6021b802443d4b0c63d9.tar.gz freeipa-a6cf44bd6538788a20fd6021b802443d4b0c63d9.tar.xz freeipa-a6cf44bd6538788a20fd6021b802443d4b0c63d9.zip |
Validation of details facet before update https://fedorahosted.org/freeipa/ticket/1676 The ticket is a duplicate of server error, but it revealed few UI errors.test-patches-2-1
Newly performs validation of details facet before update. If validation fails, notification dialog is shown and command isn't executed.
Fixed integer minimum and maximum value checking.
Read-only and non-writable fields are no longer considered required.
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r-- | install/ui/widget.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js index f88bba5c2..6ae6f5dfb 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -89,7 +89,7 @@ IPA.widget = function(spec) { return; } - if (meta.minvalue && value < meta.minvalue) { + if (meta.minvalue !== undefined && value < meta.minvalue) { that.valid = false; message = IPA.messages.widget.validation.min_value; message = message.replace('${value}', meta.minvalue); @@ -97,7 +97,7 @@ IPA.widget = function(spec) { return; } - if (meta.maxvalue && value > meta.maxvalue) { + if (meta.maxvalue !== undefined && value > meta.maxvalue) { that.valid = false; message = IPA.messages.widget.validation.max_value; message = message.replace('${value}', meta.maxvalue); @@ -131,7 +131,9 @@ IPA.widget = function(spec) { if (!values || !values.length || values[0] === '' ) { if (that.param_info && that.param_info.required && - !that.optional) { + !that.optional && + !that.read_only && + that.writable) { that.valid = false; that.show_error(IPA.messages.widget.validation.required); return false; @@ -148,10 +150,10 @@ IPA.widget = function(spec) { that.valid = true; var values = that.save(); - if (!values){ + if (!values) { return; } - if (values.length ===0 ){ + if (values.length === 0) { return; } var value = values[0]; |