Hi All

I'm converting a CGI site to Dancer and I need to convert the FORM with popup_menu that have HASH as labels:

$cgi->start_form({-name=>'box_form',-target=>"_new"}), $cgi->font({-'size'=>2,-'color'=>"#2E2E2E",-'face'=>"arial"}),$cgi +->b(), $cgi->table({-width=>"600",-border=>"1", -cellpadding=>"5", -cells +pacing=>"2", -align=>"center",-bgcolor=>"#FFFFFF",-bordercolor=>"#6E6 +E6E"}, $cgi->Tr( $cgi->td({-align=>"center",-colspan=>"2"},$cgi->font({-'si +ze'=>4,-'color'=>"#2E2E2E",-'face'=>"arial"},"Query Done") ) ), $cgi->Tr({-align=>"right"}, $cgi->td( $cgi->popup_menu({-name=>"query",-values=>\@query_ +type_mainbox,-labels=>\%query_name_mainbox, -default=>"license"} ),"Q +uery Type"), $cgi->td( $cgi->popup_menu({-name=>"cust",-values=>\@cust_co +de_sorted,-labels=>\%cust_name} ),"Customer Name", $cgi->br(),$cgi->br(), $cgi->textfield({-size=>8,-name=>"free_cust"}), "C +ustomer Code") ), $cgi->Tr({-align=>"center"}, $cgi->td({-colspan=>"2"}, $cgi->submit(-name=>"Go")) ), ), $cgi->endform, ;


A good advice will be thankful how can I write the code into the template.tt file.
This is the route:

get '/' => sub { # Create customers list my $db = connect_db(); my $sth=$db->prepare("SELECT shortcut,nameheb FROM cust"); $sth->execute() or die "$DBI::errstr"; # Create customer HASH my %cust_name; my @cust_code; while(my ($shortcut,$name) = $sth->fetchrow_array()) { $cust_name{$shortcut}="$name"; } $sth->finish(); template 'index', { hash => \%cust_name }; };

Thanks in advance


In reply to CGI to Dancer popup_menu by adriang

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.