Is there any way to use CGI.pm and still have option items sorted in pop-up menus?
CGI.pm provides cook ways to create HTML form. To create a pop-up menu, I can do something like this:
# create a hash of terms my @terms = MyLibrary::Term->get_terms(sort => 'name'); my %terms; foreach (@terms) { $terms{$_->term_id} = $_->term_name }
...
$html .= $cgi->popup_menu(-name => 'id', -values => \%terms);
where:
-name is the name of the parameter I want returned -values is a reference to a hash containing id and value pairs.
The problem is that -values is a hash, and when CGI.pm displays the pop-up menu the items do not come out sorted. (They were inserted into the hash in a sorted order.)
Is there some I can get CGI.pm to output the popup items in sorted order, or should I write my own little function to do this for me?
-- Eric Lease Morgan University Libraries of Notre Dame