summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-12-22 20:34:43 +0545
committerPhil Davis <phil.davis@inf.org>2015-12-22 20:34:43 +0545
commit5736b2ce513ab3a9065f32f74a754ed4d815894a (patch)
tree0b1ed52564760171e74b8443ea454730688f2051
parentf84d2a908c5e40a17867a091ca5770ec03618178 (diff)
downloadpfsense-5736b2ce513ab3a9065f32f74a754ed4d815894a.zip
pfsense-5736b2ce513ab3a9065f32f74a754ed4d815894a.tar.gz
HTML Compliance - Form Select 3rd try
This is a combined version of: https://github.com/pfsense/pfsense/pull/2310 https://github.com/pfsense/pfsense/pull/2315
-rw-r--r--src/usr/local/www/classes/Form/Select.class.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/usr/local/www/classes/Form/Select.class.php b/src/usr/local/www/classes/Form/Select.class.php
index c7d73c1..13c49f7 100644
--- a/src/usr/local/www/classes/Form/Select.class.php
+++ b/src/usr/local/www/classes/Form/Select.class.php
@@ -66,7 +66,14 @@ class Form_Select extends Form_Input
$selected = ($sval == $value);
}
- $options .= '<option value="'. htmlspecialchars($value) .'"'.($selected ? ' selected' : '').'>'. htmlspecialchars(gettext($name)) .'</option>';
+ if (!empty(trim($name)) || is_numeric($name)) {
+ $name_str = htmlspecialchars(gettext($name));
+ } else {
+ // Fixes HTML5 validation: Element option without attribute label must not be empty
+ $name_str = "&nbsp;";
+ }
+
+ $options .= '<option value="'. htmlspecialchars($value) .'"'.($selected ? ' selected' : '').'>'. $name_str .'</option>';
}
return <<<EOT
@@ -75,4 +82,4 @@ class Form_Select extends Form_Input
</select>
EOT;
}
-} \ No newline at end of file
+}
OpenPOWER on IntegriCloud