backedge has asked for the wisdom of the Perl Monks concerning the following question:
I have a need to produce tooltip help on each option that appears in a popup_menu in CGI.pm. I know this is possible by adding a title attribute to each option, so the browser shows this when the mouse hovers over it. I can't figure out how to do it within popup_menu.
Here's a code snippet that works using Select (deprecated) instead of popup_menu:
print $q->start_Select({ -id => 'idprd_order_allowed', -name => 'prd_order_allowed', -override => 1, -onChange => "changeInCore=true", -default => $prd_order_allowed }); foreach my $option (@low_values_prd_order_allowed){ print $q->option({ -value=>"$option", -title=>"$titles_prd_order_allowed{$option}"}, "$meanings_prd_order_ +allowed{$option}"); } print $q->end_Select();
I want to replicate that -title=> behaviour in popup_menu() - currently have:
print $q->popup_menu( -id => 'idprd_order_allowed', -name => 'prd_order_allowed', -override => 1, -onChange => "changeInCore=true", -default => $prd_order_allowed, -value => [@low_values_prd_order_allowed], -labels => \%meanings_prd_order_allowed );
I'm sure (I hope!) there is a simple option similar to -labels that I am missing. Any suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding attributes to select list options in CGI.pm popup_menu?
by Anonymous Monk on Jun 30, 2011 at 12:06 UTC | |
by backedge (Initiate) on Jun 30, 2011 at 13:59 UTC |