so i've read through the perldoc for HTML::Template and through HTML::Template Tutorial, and associate does really look like it could save my day here ...

i have a form for which i'd have to pull out a bunch of popup menu name/value pairs (states and abbrevs, etc), but i really don't want to go through and create *another* version of this, since this client's stuff doesn't have a database.

here's the code from the script:

my $qry = CGI->new(); my $vars = $qry->Vars(); my $tmpl = HTML::Template->new( filename => $tmpls{$tmplName}, die_on_bad_params => 0, associate => $qry ); $tmpl->param( $vars ); my $msg = $tmpl->output(); print $qry->header, $msg;
nice and simple, no? problem is, the selected state value isn't being preserved. all the other values are ... ( because i've hand-added  <TMPL_VAR NAME='foo'> but not the 2 popup menus (which are hand-coded in the HTML).

am i misunderstanding the use of associate here? the value for USERSTATE ( the param name in this case ) is passed as part of the info in the $vars hashref ... but the same value isn't *technically* under the control of HTML::Template ( no TMPL_LOOP creating it, basically ).


In reply to HTML::Template, associate 'method', and popup menus by geektron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.