Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

display hash in an html template

by rsennat (Beadle)
on Nov 03, 2005 at 15:10 UTC ( [id://505384]=perlquestion: print w/replies, xml ) Need Help??

rsennat has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,
I have an hash of arrays which needs to be put into an HTML Template. So that hash of arrays may contain text value or selection box or drop down box.

I could do it but its really very complex. For each and every selection box, I need to create a TMPL VAR and display the values.

Is there a simpler way to do this??

Thanks.

Replies are listed 'Best First'.
Re: display hash in an html template
by Kanji (Parson) on Nov 03, 2005 at 15:29 UTC

    You may want to consult the FAQ section of HTML::Template's POD. Specifically...

    Q: What's the best way to create a <select> form element using HTML::Template?

        --k.


Re: display hash in an html template
by nedals (Deacon) on Nov 04, 2005 at 02:09 UTC
    Or something like this....
    my $ary_ref = [ { value=>1, text=>'val1'}, { value=>2, text=>'val2'}, ]; .. $template->param( select = $ary_ref, ... ); ### .tmpl <select> <TMPL_LOOP NAME=select> <option value="<TMPL_VAR NAME=value>"><TMPL_VAR NAME=text></TMPL_LOOP> </select>
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-25 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found