From 7da8d2f296ce10fc926bff01bc22cd3e0d7b7c46 Mon Sep 17 00:00:00 2001 From: Petr Voborník Date: Thu, 23 Feb 2012 13:54:07 +0100 Subject: Added unsupported_validator dnszone attributes idnsallowquery and idnsallowtransfer have valid but currently unsupported values: 'localhost' and 'localnets'. New validator was introduced for unsuported values. By using this validator user can see that the value is currently unsupported instead of showing 'invalid value' or passing the value to server and creating error there. https://fedorahosted.org/freeipa/ticket/2351 --- install/ui/field.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'install/ui/field.js') diff --git a/install/ui/field.js b/install/ui/field.js index 4f88c16e..e78a4e96 100644 --- a/install/ui/field.js +++ b/install/ui/field.js @@ -459,6 +459,25 @@ IPA.metadata_validator = function(spec) { return that; }; +IPA.unsupported_validator = function(spec) { + + var that = IPA.validator(spec); + + that.unsupported = spec.unsupported || []; + that.message = spec.message || IPA.messages.widget.validation.unsupported; + + that.validate = function(value, context) { + + if (IPA.is_empty(value)) return that.true_result(); + + if (that.unsupported.indexOf(value) > -1) return that.false_result(); + + return that.true_result(); + }; + + return that; +}; + IPA.checkbox_field = function(spec) { spec = spec || {}; -- cgit