summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/classes
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-10-20 13:51:51 +0930
committerRenato Botelho <renato@netgate.com>2016-11-10 08:01:28 -0200
commit6df432c3e50c288aa664eec02713457c62d8a8f5 (patch)
treec2d16ced0fca3df37e03cd900286ccd29b68653d /src/usr/local/www/classes
parent694872ae460e0a5533dbb792592a9d0d06121869 (diff)
downloadpfsense-6df432c3e50c288aa664eec02713457c62d8a8f5.zip
pfsense-6df432c3e50c288aa664eec02713457c62d8a8f5.tar.gz
Fix #6864 automatically convert IPv6 input to lowercase
1) As the user leaves the field, or presses Save, onChange will fire and convert the input string to lowercase. This saves the user havng to even think about it. 2) Provide some extra text that describes the expected format, to avoid them getting just "Please match the requested format" (cherry picked from commit d461ff40e364fc0ecc003b9f673cbad7c6a08f2f)
Diffstat (limited to 'src/usr/local/www/classes')
-rw-r--r--src/usr/local/www/classes/Form/IpAddress.class.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/usr/local/www/classes/Form/IpAddress.class.php b/src/usr/local/www/classes/Form/IpAddress.class.php
index 6aad468..376b3b1 100644
--- a/src/usr/local/www/classes/Form/IpAddress.class.php
+++ b/src/usr/local/www/classes/Form/IpAddress.class.php
@@ -63,14 +63,19 @@ class Form_IpAddress extends Form_Input
switch ($type) {
case "BOTH":
$this->_attributes['pattern'] = '[a-f0-9:.]*';
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an IPv6 address like 1:2a:3b:ffff::1 (use lowercase)';
+ $this->_attributes['onChange'] = 'javascript:this.value=this.value.toLowerCase();';
break;
case "V4":
$this->_attributes['pattern'] = '[0-9.]*';
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4';
break;
case "V6":
$this->_attributes['pattern'] = '[a-f0-9:]*';
+ $this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1 (use lowercase)';
+ $this->_attributes['onChange'] = 'javascript:this.value=this.value.toLowerCase();';
break;
}
}
OpenPOWER on IntegriCloud