From 5736b2ce513ab3a9065f32f74a754ed4d815894a Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Tue, 22 Dec 2015 20:34:43 +0545 Subject: 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 --- src/usr/local/www/classes/Form/Select.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/usr/local') 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 .= ''; + 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 = " "; + } + + $options .= ''; } return << EOT; } -} \ No newline at end of file +} -- cgit v1.1