[html-formfu] How to handle checkboxes
Moritz Onken
onken at houseofdesign.de
Wed Aug 27 13:25:01 BST 2008
Am 27.08.2008 um 14:19 schrieb Dermot:
> Hi,
>
> As a first post I would like to say what a great framework FormFu is.
>
> I have a feeling my first question is not the smartest to ask but
> here goes.
>
> My form has a series of checkboxs that correspond to true/false
> fields.
>
> I am doing this to
>
> if ($c->model->{val} == 1) {
> $box->attributes->{checked} = 'true';
> }
>
>
> This gives me a source like this
>
>
> <label>Has type</label>
> <input name="hastype" type="checkbox" checked="true" />
>
>
> My query is whether this is correct HTML (4)?
>
> I had a look at the WC3 site and I think checked is an attribute but I
> thought I should be getting a source like
> <input name="hastype" type="checkbox" checked />
>
> Am I using the right methods?
> Thanx,
> Dp.
Hi,
this checked="checked" is valid html (4) and especially xhtml. Because
xhtml does not allow stand-alone attributes like checked.
You can always edit the xhtml templates which generate this checkbox.
moritz
More information about the HTML-FormFu
mailing list