Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-24 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found