[Solar-talk] Checkbox and radio labels with Solar_View_Helper_Form
Paul M Jones
pmjones at solarphp.com
Tue Sep 5 09:25:30 PDT 2006
On Sep 5, 2006, at 11:16 AM, Rodrigo Moraes wrote:
> I'm trying to add a checkbox or radio label using
> Solar_View_Helper_Form:
>
> echo $this->form()
> ->checkbox(array(
> 'name' => 'persist',
> 'value' => '1',
> 'options' => array(0 => 1),
> 'label' => $this->getTextRaw('LABEL_PERSIST'),
> )
> ->submit(array(
> 'name' => 'submit',
> 'value' => $this->getTextRaw('SUBMIT_LOGIN')
> ))
> ->fetch();
>
> The result is a duplicated label for the checkbox.
Ah crap, you're right. That's partly because the checkbox helper
(none of the form element helpers, really) know they're part of a
form-group. Radio buttons work in a similar fashion, but then you
expect to have multiple options there.
> Perhaps it is
> necessary to separate the "checkbox-group" label from the checkbox
> label itself? I just need one checkbox, one single label. If it was a
> series of checkboxes, I guess a group label would be necessary, and
> then one label for each element.
Let me see what I can do about this. Maybe add a special attrib or
property for the checkbox helper called "nolabel" to suppress the
checkbox label itself, that the form() helper can set when not in a
group.
> I'm missing something probably,
> because the current behaviour makes checkboxes unusable with
> Solar_View_Helper_Form.
"Unusable" might be a bit strong, but certainly it doesn't look the
way it should. Sorry for the trouble.
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list