Home » HTML » HTML_QuickForm » Bug #2898
Support additional attributes for elements
Details
| Request #2898 | Support additional attributes for elements |
|---|---|
| Submitted | 2004-12-05 11:56 UTC |
| From | fullung at gmail dot com |
| Status | Closed |
| Package | HTML_QuickForm |
| PHP Version | 4.3.9 |
| Roadmaps | (Not assigned) |
Comments
[2004-12-05 11:56 UTC] fullung at gmail dot com
Description:
------------
I'd like to request a feature.
When laying out complex forms, it is sometimes handy to use CSS to specify various aspects of the form appearance (e.g. text input font size, padding, etc.).
In order to do this, one must be able to set the "class" attribute of each element in order to specify what CSS it should use (maybe for some text inputs you want font-size: 9px and width: 100px and for other font-size: 12px and width: 20px).
I don't see an easy way to do this with HTML_QuickForm. Maybe one could write a custom renderer...
I suggest extending the HTML_QuickForm_element class with addAttribute(name, value) and removeAttribute(name) methods to facilitate this. Perhaps the constructor could also be extended to take an array parameter of attribute-value pairs.
[2004-12-05 13:23 UTC] bmansion at mamasam dot com
HTML_QuickForm_element extends HTML_Common.
I suggest you look at the methods available in HTML_Common.
You can also add a class attribute when adding an element:
$form->addElement('text', 'textfield', 'Text :', array('class' => 'myclass'));