Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: creating CGI::scrolling_list ... can this be shortened?

by kutsu (Priest)
on Jul 22, 2005 at 21:42 UTC ( #477359=note: print w/ replies, xml ) Need Help??


in reply to creating CGI::scrolling_list ... can this be shortened?

Using much the same technique as described here:

my $sth = $dbh->prepare("SELECT id, display_name FROM membership ORDER + BY display_name"); $sth->execute; my %row; $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } )); while ($sth->fetch) { my $memberWidget = $q->scrolling_list( -name => '...', -values => [ @row{sort keys %row}], -labels => \%row, ... ); push (@memberWidgets, $memberWidget); }

I'm not sure about the -values and -labels option of scrolling_list (as I've never used CGI built-ins) but this should get you started (and the keys aren't sorted but the order you get it from the database is the same).

"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce


Comment on Re: creating CGI::scrolling_list ... can this be shortened?
Download Code
Re^2: creating CGI::scrolling_list ... can this be shortened?
by geektron (Curate) on Jul 22, 2005 at 23:58 UTC
    well, since you're not familiar with the CGI builtins, you're missing something very imporant ... you're creating N widgets ( where N is the number of rows returned ), not creating N options in the scrolling list.

    i'm sure something more like a Scwartzian Transform in the original  map would do it...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2014-08-02 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (54 votes), past polls