Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by kutsu (Priest)
on Jul 22, 2005 at 21:42 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2024-04-19 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found