]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
add DnsOrIp vtype
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 13 Mar 2019 14:17:09 +0000 (15:17 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 14 Mar 2019 06:38:21 +0000 (07:38 +0100)
this is useful for options that can be dns names or ips (e.g. ldap servers)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Toolkit.js

index 4f1b623408e6a24fa938426c146188ce6d182263..bb9157f8ec0dd3f5b1e538517655f46ad33af1b0 100644 (file)
@@ -108,6 +108,17 @@ Ext.apply(Ext.form.field.VTypes, {
     },
     proxmoxMailText: gettext('Example') + ": user@example.com",
 
+    DnsOrIp: function(v) {
+       if (!Proxmox.Utils.DnsName_match.test(v) &&
+           !Proxmox.Utils.IP64_match.test(v))
+       {
+           return false;
+       }
+
+       return true;
+    },
+    DnsOrIpText: gettext('Not a valid DNS name or IP Address.'),
+
     HostList: function(v) {
        var list = v.split(/[\ \,\;]+/);
        var i;