diff options
author | NOYB <Al_Stu@Frontier.com> | 2015-12-13 00:51:42 -0800 |
---|---|---|
committer | NOYB <Al_Stu@Frontier.com> | 2015-12-13 00:51:42 -0800 |
commit | 94826107ee5c94fcf993f4bd8cbf954aea1ef13d (patch) | |
tree | e3d77086ecfa97569ca88e1a4437e0de244481ae /src/usr/local/www/classes | |
parent | b21e40099d85fa0a83e4d8fc87721e0a7559cdab (diff) | |
download | pfsense-94826107ee5c94fcf993f4bd8cbf954aea1ef13d.zip pfsense-94826107ee5c94fcf993f4bd8cbf954aea1ef13d.tar.gz |
HTML Compliance - Checkbox Display As Radio Unique ID
Ensure checkbox display as raido has unique id.
Allow an id to be passed in displayAsRadio() as argument[0].
If no argument is passed, construct id as name_value:uniqid.
Previous behavior was id = name. So all the radio buttons of the set had same id.
Diffstat (limited to 'src/usr/local/www/classes')
-rw-r--r-- | src/usr/local/www/classes/Form/Checkbox.class.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/usr/local/www/classes/Form/Checkbox.class.php b/src/usr/local/www/classes/Form/Checkbox.class.php index e0734de..d94c210 100644 --- a/src/usr/local/www/classes/Form/Checkbox.class.php +++ b/src/usr/local/www/classes/Form/Checkbox.class.php @@ -46,10 +46,16 @@ class Form_Checkbox extends Form_Input $this->column->addClass('checkbox'); } - public function displayAsRadio() + public function displayAsRadio($id = null) { $this->_attributes['type'] = 'radio'; + if ($id != null) { + $this->_attributes['id'] = $id; + } else { + $this->_attributes['id'] = $this->_attributes['name'] . '_' . $this->_attributes['value'] . ':' .substr(uniqid(), 9); + } + return $this; } |