godsgood33 has asked for the wisdom of the Perl Monks concerning the following question:

I have a prototype page that I'm working on and I'm trying to figure out how to use a scrolling_list. I've got it created... scrolling_list( { -name => 'stage1left', -id => 'stage1left', -size => 10, -class => 'list', -multiple => 'true' } ) I am populating it with AJAX. On the submit I am just trying to print it out to the next page that displays...
my @left = param( 'stage1left' ); print header(),"@left";
However, nothing prints out. I can add in some extra text like  print header(),'test',"@left"; and the 'test' prints, but nothing else. Using Firebug, I can determine that the 'stage1left' is never getting passed or it is getting passed as ".cgifields". Any help would be wonderful. Thanks!

Replies are listed 'Best First'.
Re: CGI Scrolling_List
by Khen1950fx (Canon) on Jan 15, 2012 at 20:07 UTC
    This might help:
    #!/usr/bin/perl use strict; use warnings; use CGI; my $q = new CGI; print $q->header; print $q->start_html('Stage1.cgi'); unless ($q->param) { print $q->startform; print $q->h3("Select Stage: "); print $q->scrolling_list( -values => [ 'Stage1', 'Stage1left', 'Stage1right' ], -size => 10, -multiple => 'true' ); print $q->br; print $q->submit(-value => "Your Stage selection"); print $q->endform; }
      That's not really what I was looking for. That creates the the scrolling_list, but I already have that as listed in my original post. What I am looking for is that when the page is submitted the values get sent to the CGI app and process, but the problem is that when submitting the page there is no named object called 'stage1left'. That is what I named the scrolling_list and so I should be able to say print param('stage1left'); and it will print out the selected values. Which that made me realize that when I am submitting the form there are no <option> selected in the listbox. The way I have it set up is that there is a left box and right box...move the values you want to the right and those are used...so I just need to "select" all the items in the listbox and that will work for the CGI.