GSTAR
(Omzy83)
December 7, 2009, 3:56pm
1
<?php echo CHtml::checkBox('', $_GET['location'], array('value'=>'')); ?>
As you can see here I made the ‘name’ and ‘value’ attributes empty, however it still generates these attributes in the html (name="" value="").
How can I prevent it from generating these attributes?
GSTAR
(Omzy83)
December 8, 2009, 8:44pm
3
Can someone help me with this please?
tri
(tri - Tommy Riboe)
December 8, 2009, 9:11pm
4
I think your options are to either implement the html yourself or to override CHtml::checkBox() and CHtml::inputField().
/Tommy
jayrulez
(Waprave)
December 8, 2009, 9:11pm
5
um, you can remove that form field completely, or u can check in ur model beforeSave if the attribute is empty, it it is then re-assign it to null.
GSTAR
(Omzy83)
December 8, 2009, 10:20pm
6
Cheers guys. I think the best option is to implement the HTML myself, although I do think the attributes should not be generated if you set the value to ‘false’.