Fellow Monasterians,
I'm I have gotten HTML::FillInForm to populate a form using a somewhat busy bunch of code:
my $q = new CGI; $q -> param(-name => 'choices', -value => '2'); $q -> param(-name => 'address', -value => '123 Main Street'); my $template = HTML::Template->new( filename => "../form.tmpl"); my $html = $template->output; my $form = new HTML::FillInForm; my $page = $form->fill(scalarref => \$html, fobject => $q); print "Content-type: text/html\n\n"; print $page;
The doc for HTML::FillInForm says that the fobject will accept a hash ref, but I this returns an "unblessed" error:
my $q = new CGI; my $info = [ { -name => 'address', -value => '123 Main' }, { -name => 'choices', -value => '2'} ]; my $template = HTML::Template->new( filename => "../form.tmpl"); + my $html = $template->output; my $form = new HTML::FillInForm; my $page = $form->fill(scalarref => \$html, fobject => $info); print "Content-type: text/html\n\n"; print $page;
I would like to loop through data from by db table to populate this hash. Is there a way to do this cleanly? Or am I just not getting this? Thanks!
Update: Please see my findings, which are under the review of the HTML::FillInForm module itself.
In reply to Trying to pass a hash ref to a module by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |