diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 05dc6b740f0..278545bff59 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -4747,11 +4747,19 @@ }, 'startport': { edit: true, - label: 'label.start.port' + label: 'label.start.port', + validation: { + number: true, + range: [0, 65535] + } }, 'endport': { edit: true, - label: 'label.end.port' + label: 'label.end.port', + validation: { + number: true, + range: [0, 65535] + } }, 'icmptype': { edit: true, @@ -4766,7 +4774,10 @@ 'cidr': { edit: true, label: 'label.cidr', - isHidden: true + isHidden: true, + validation: { + ipv4cidr: true + } }, 'accountname': { edit: true, @@ -4946,11 +4957,19 @@ }, 'startport': { edit: true, - label: 'label.start.port' + label: 'label.start.port', + validation: { + number: true, + range: [0, 65535] + } }, 'endport': { edit: true, - label: 'label.end.port' + label: 'label.end.port', + validation: { + number: true, + range: [0, 65535] + } }, 'icmptype': { edit: true, @@ -4965,7 +4984,10 @@ 'cidr': { edit: true, label: 'label.cidr', - isHidden: true + isHidden: true, + validation: { + ipv4cidr: true + } }, 'accountname': { edit: true, diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js index c4de8cecbe2..48b2ac3929f 100755 --- a/ui/scripts/ui/widgets/multiEdit.js +++ b/ui/scripts/ui/widgets/multiEdit.js @@ -992,6 +992,10 @@ .attr('disabled', field.isDisabled ? 'disabled' : false) .appendTo($td); + if (field.validation) { + $td.find('input').first().data("validation-settings", field.validation ); + } + if (field.isDisabled) $input.hide(); if (field.defaultValue) { $input.val(field.defaultValue); @@ -1243,6 +1247,11 @@ $multiForm.validate(); + var inputs = $multiForm.find('input'); + $.each(inputs, function() { + if ($(this).data && $(this).data('validation-settings')) + $(this).rules('add', $(this).data('validation-settings')); + }); return this; };