Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2021-03-01 16:55 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (13 votes). Check out past polls.