Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(jeffa) Re: Sticky Forms with HTML::Template

by jeffa (Bishop)
on Dec 28, 2002 at 19:37 UTC ( [id://222776]=note: print w/replies, xml ) Need Help??


in reply to Sticky Forms with HTML::Template

Did you try associate first? From the docs:

   associate - this option allows you to inherit the
   parameter values from other objects.  The only
   requirement for the other object is that it have a
   param() method that works like HTML::Template's
   param().  A good candidate would be a CGI.pm query
   object.  Example:

     my $query = new CGI;
     my $template = HTML::Template->new(
        filename => 'template.tmpl',
        associate => $query
     );

   Now, $template->output() will act as though

     $template->param('FormField', $cgi->param('FormField'));

   had been specified for each key/value pair that
   would be provided by the $cgi->param() method.
   Parameters you set directly take precedence over
   associated parameters.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
  • Comment on (jeffa) Re: Sticky Forms with HTML::Template

Replies are listed 'Best First'.
Re: (jeffa) Re: Sticky Forms with HTML::Template
by seattlejohn (Deacon) on Dec 28, 2002 at 19:55 UTC
    I looked at associate, but I couldn't think of a straightforward way to make it work with things like multi-select list boxes.

            $perlmonks{seattlejohn} = 'John Clyman';

      Yes, you are correct about select boxes - read samtregar's HTML::Template FAQ number 11 and you will see that your method is actually quite sound (he recommends using CGI.pm - see Re: TMPL_LOOP within a TMPL_LOOP). Perhaps a combination of associate and CGI.pm's popup_menu() and scrolling_list() would make for an elegant solution. Cheers :)

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://222776]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found