[html-formfu] name and id are missing from customized Checkboxgroup elements

kewei xiao kewei.xiao at nald.ca
Wed Dec 19 14:55:10 GMT 2007


Hi Carl

    After I used Checkboxgroup in my customized element, it appears that 
name, id and attributes_xml are missing.  I am not sure if I have done 
something wrong, below is the code:

sub setup {
    my $self = shift;
    $self->container_tag( 'div' );
    $self->attributes( { class => 'scrollable' } );


    my $c = $self->form->stash->{ context };

    my $units = $c->model( 'Activities::Unit' )->search();

    my %checked = eval {
        map { $_->unit->unit_id => $_->unit->unit_id }
            $c->stash->{ activities }->outcomes;
    };

    $self->options(
        [   map {
                {
                    value => $_->unit_id,
                    label => join( ' -- ', $_->subject->name, $_->name ),
                    default => $checked{ $_->unit_id } || undef,
                    name => 'subject',
                    id   => 'subject_' . $_->unit_id,
                    attributes_xml => {
                        onClick =>
                            "if ( this.checked == true) 
{showOutcomes(this.id)} else {removeBox(this.id)}"
                    }
                }
                } $units->all
        ]
    );

    return $self->next::method( @_ );
}


Please advise.  Thanks

Ke Wei



More information about the HTML-FormFu mailing list