diff options
author | NOYB <Al_Stu@Frontier.com> | 2015-12-19 01:09:31 -0800 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-21 08:33:18 -0500 |
commit | f35ce6d20e6fd1e3b66b5935c70532d7e5fa741f (patch) | |
tree | decc2b761b511a9acfaf408671f0eb8ada799fb7 /src/usr/local/www/classes/Form | |
parent | 4bc0cbc385eb07731ba8216833c048259fac5ed4 (diff) | |
download | pfsense-f35ce6d20e6fd1e3b66b5935c70532d7e5fa741f.zip pfsense-f35ce6d20e6fd1e3b66b5935c70532d7e5fa741f.tar.gz |
HTML Compliance - Form Group - Label For
The for attribute of the label element must refer to a non-hidden form control.
Diffstat (limited to 'src/usr/local/www/classes/Form')
-rw-r--r-- | src/usr/local/www/classes/Form/Group.class.php | 8 | ||||
-rw-r--r-- | src/usr/local/www/classes/Form/Input.class.php | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/usr/local/www/classes/Form/Group.class.php b/src/usr/local/www/classes/Form/Group.class.php index 4ddf70d..1218728 100644 --- a/src/usr/local/www/classes/Form/Group.class.php +++ b/src/usr/local/www/classes/Form/Group.class.php @@ -130,7 +130,13 @@ EOT; foreach ($missingWidth as $input) $input->setWidth($spaceLeft / count($missingWidth)); - $target = $this->_labelTarget->getId(); + if (strtolower($this->_labelTarget->get_Type()) == 'hidden') + $hidden = true; + + $form_controls = array('input', 'select', 'button', 'textarea', 'option', 'optgroup', 'fieldset', 'label'); + if (in_array(strtolower($this->_labelTarget->gettagName()), $form_controls) && !$hidden) + $target = $this->_labelTarget->getId(); + $inputs = implode('', $this->_inputs); $help = $this->_getHelp(); diff --git a/src/usr/local/www/classes/Form/Input.class.php b/src/usr/local/www/classes/Form/Input.class.php index af04b82..80b96c8 100644 --- a/src/usr/local/www/classes/Form/Input.class.php +++ b/src/usr/local/www/classes/Form/Input.class.php @@ -85,6 +85,16 @@ class Form_Input extends Form_Element return $this->_attributes['id']; } + public function get_Type() + { + return $this->_attributes['type']; + } + + public function gettagName() + { + return $this->_tagName; + } + public function setHelp($help, array $params = array()) { $this->_help = $help; |