bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to pass a hash ref to a module
by davido (Cardinal) on May 17, 2005 at 20:00 UTC | |
by bradcathey (Prior) on May 17, 2005 at 21:23 UTC | |
by djohnston (Monk) on May 18, 2005 at 07:45 UTC | |
by bradcathey (Prior) on May 18, 2005 at 11:16 UTC | |
|
Re: Trying to pass a hash ref to a module
by jdporter (Paladin) on May 17, 2005 at 19:59 UTC | |
|
Re: Trying to pass a hash ref to a module
by mrborisguy (Hermit) on May 17, 2005 at 19:57 UTC |