[html-formfu] How to make checkbox (checked/unchecked) database
driven
Carl Franks
fireartist at gmail.com
Thu Jul 5 21:35:17 GMT 2007
On 05/07/07, kewei xiao <kewei.xiao at nald.ca> wrote:
> Now I set up the 'default' to be checked. Is it a way to make it
> unchecked according to a certain condition? In my case the condition
> will be the non-administrator users' checkbox will be un-checked:
It will be checked it 'default' equals 'value', so you want something
like this pseudo-code:
$self->elements( [ map { {
type => $type,
name=>'role',
value=> $_->id,
label => $_->name,
default => ( $user->is_member_of($_->id) ? $_->id : undef ),
} } $roles->all ] );
More information about the HTML-FormFu
mailing list