[Maypole] CDBI::AsForm and checkboxes
Peter Speltz
peterspeltz@yahoo.com
Thu, 14 Apr 2005 19:23:08 -0700 (PDT)
--- Joshua Keroes <jkeroes@eli.net> wrote:
>
> What's the smart way to go about rendering boolean values (i.e.
> TINYINT(1)) in the database as checkboxes? More specifically, is there
> an update to CDBI::AsForm that includes checkbox support? I thought we'd
> gone over this before on the list, but google's not finding any matches.
>
Ian on this and the cdbi list has checkbox and radio button support in his
AsForm. I used to have a copy but can't find it at the moment. Basically just
make a "_to_bool_checkbox" sub and put a clause like this in "to_field" with
all the other clauses like this:
return $self->_to_bool_checkbox($col) if $type && $type =~ /tinyint(1)/i;
HTH
pjs
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com