remove leading zeros in IPv4 address

This commit is contained in:
bergware
2023-12-09 14:52:36 +01:00
parent 0f767eb9f7
commit 030f79e69e

View File

@@ -76,6 +76,7 @@ array_multisort($sort_eth0,$vlan_eth0);
refresh(); // automatically include new ethernet ports
<?endif;?>
Array.prototype.same = function(){return this.sort().filter(function(v,i,o){return i&&v===o[i-1]?v:0;}).length;}
String.prototype.peel = function(){return this.split('.').map(Number).join('.');}
function prepareSettings(form) {
var bondnics = [], brnics = [];
@@ -109,6 +110,10 @@ function prepareSettings(form) {
swal({title:'Duplicate metrics',text:'List of default gateways contains duplicate metric values',type:'error',html:true,confirmButtonText:"_(Ok)_"});
return false;
}
// remove leading zeros in IPv4 address
$(form).find('input[name^="IPADDR:"]').each(function(){
$(this).val($(this).val().peel());
});
if (form.TYPE.value == 'access') {
$(form).find('input[name^="VLANID:"]').prop('disabled',false).val('');
$(form).find('input[name^="DESCRIPTION:"]').not('input[name$=":0"]').prop('disabled',false).val('');