[dave.riverside@gmail.com - Fri Sep 30 20:21:47 2005]:
Show quoted text> On 10/1/05, Guest via RT <bug-Maypole-FormBuilder@rt.cpan.org> wrote:
> >
> > This message about Maypole-FormBuilder was sent to you by guest <>
> via rt.cpan.org
> anyway..
> > I have all these form_builder_defaults->{options} all over the place
> in my classes, but when quick_table is called, it just prints the
> database values. It would be kind of cool if we could specify
> field options in one place, and have them read by both formbuilder
> and quicktable. Same goes for field_labels. Thoughts?
> >
>
> I'll have a look at quicktable and see what I can come up with for
> field options. I'll have a look at getting Mp-P-FB to use
> column_names() to build field labels.
>
> d.
For Field options, I am doing this in QuickTable.pm:
my $lister = sub
{
my $col = shift;
if($object->can('form_builder_defaults') && exists
$object->form_builder_defaults->{options}->{$col} && exists
return
$object->form_builder_defaults->{options}->{$col}->{$object->$col};
}
return '' unless @_;
return @_ if @_ == 1;
return join( "\n", '<ol>', ( map { "<li>$_</li>" } @_ ), '</ol>' );
};
Then, below when you call $lister, pass $_ as the first argument.
The multiple "exists" are necessary to prevent auto-vivification, which
seems to blow up formbuilder in some cases. That was fun to track down.