From 2bffc5c1b7c03284246c8e68bb98097f3e77020c Mon Sep 17 00:00:00 2001 From: laf Date: Fri, 1 Jul 2016 10:27:15 +0100 Subject: [PATCH] updates as per comments from murrant --- html/includes/table/edit-ports.inc.php | 2 +- html/pages/device/edit/ports.inc.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/html/includes/table/edit-ports.inc.php b/html/includes/table/edit-ports.inc.php index 16c0fc1174..ac79957411 100644 --- a/html/includes/table/edit-ports.inc.php +++ b/html/includes/table/edit-ports.inc.php @@ -71,7 +71,7 @@ foreach (dbFetchRows($sql, $param) as $port) { ', 'port_tune' => '', 'ifAlias' => '
', - 'ifSpeed' => '
', + 'ifSpeed' => '
', ); }//end foreach diff --git a/html/pages/device/edit/ports.inc.php b/html/pages/device/edit/ports.inc.php index 7cc3b78c57..586ebe8cdc 100644 --- a/html/pages/device/edit/ports.inc.php +++ b/html/pages/device/edit/ports.inc.php @@ -16,7 +16,7 @@ Oper Disable Ignore - ifSpeed + ifSpeed (bits/s) RRD Tune Description @@ -67,7 +67,8 @@ } }); }); - $(document).on('blur', "[name='if-speed']", function (){ + $(document).on('blur keyup', "[name='if-speed']", function (e){ + if (e.type === 'keyup' && e.keyCode !== 13) return; var $this = $(this); var speed = $this.val(); var device_id = $this.data('device_id'); @@ -82,6 +83,8 @@ if (data.status == 'ok') { $this.closest('.form-group').addClass('has-success'); $this.next().addClass('glyphicon-ok'); + var new_val = speed.text().replace(/[^0-9]/gi, ''); + $this.val(new_val); setTimeout(function(){ $this.closest('.form-group').removeClass('has-success'); $this.next().removeClass('glyphicon-ok');