Parameter query!

Clooney, David david.clooney at bankofamerica.com
Tue Aug 21 13:09:50 BST 2007


Hi all

 

I joined this list a while back and was warned that everything other
than perl is discussed, however I thought I would attempt to extract
some of the wealth of knowledge lying beneath the discussions of
arbitrary affairs.

 

Newbie to perl so Here goes and don't laugh at my code, ok go on then.

 

Using CGI.pm

 

I am trying to pass all the values of a checkbox group to a subroutine
but failing miserably.

 

The subroutine below generates a form with all files/directories  found,
based upon search criteria. all files are populated into the same
checkbox group with different values. This all works fine, but passing
the values to the next subroutine I having issues with.

 

sub   spdm828a_technical_files_to_checkbox {

           foreach $spdm828a_tech_file_list_part
(@spdm828a_tech_file_list_part) {

                        $spdm828a_tech_file_list_part =~ s/\s+$//;

                        chop $spdm828a_tech_file_list_part;

 

           if ( $spdm828a_tech_file_list_part =~ /\/$/) {

                            print start_Tr({ -bgcolor => "#F0F8FF"}),
start_td, 'Directory  ',end_td , start_td,

 
checkbox_group(-name=>'spdm828a_tech_file_selection',
-value=>"$spdm828a_tech_file_list_part"),

                 br,

                 end_td, end_Tr;

                         }

           else {

           print start_Tr({ -bgcolor => "#FFFFFF" }), start_td,
'File',end_td , start_td,

                  checkbox_group(-name=>'spdm828a_tech_file_selection',
-value=>"$spdm828a_tech_file_list_part"),

                 

                   br,

                 end_td, end_Tr;

 

                         }

 

      }

}

 

What I don't get is that when I print
(param('spdm828a_tech_file_selection')) below, all the selections from
the previous form are concatenated into one long string, this is fine ,
but if I declare the parameter into a string i.e $file_select and then
print it I only get the first option selected from the checkbox group
from the previous form.

 

sub sub_technical_create_mail {

    $file_select = (param('spdm828a_tech_file_selection'));

    if ($file_select) {

 

 print start_html(-title=>'NCG UK Restore
Portal',-style=>{'src'=>"$style"}),

      h1({-align=>'center'},'NCG UK Restore portal'),

      h3({-align=>'center'},'NCG Restore Submit Selection');

      print start_form,

      pre,

                 'Please confirm the selection you have made in order
for the request to be Carried out',

      "\n",

      p;

print p;

      print "$file_select\n";

      print (param('spdm828a_tech_file_selection')),"\n";

      print "\n";

      print "end\n";

print       br,

      submit(-name=>'Submit_final'),

      end_form;

     }

    else {

 print start_html(-title=>'NCG UK Restore
Portal',-style=>{'src'=>"$style"}),

      h1({-align=>'center'},'NCG UK Restore portal'),

      h3({-align=>'center'},'NCG Restore Submit Selection');

      print start_form,

      pre,

                 'You have not selected any data to be restored',

      "\n",

      ;

     }

}

 

Any ideas on how I can get each checkbox group selection onto a new line
in the second sub would be much appreciated.

 

Dave

 

 




Notice to recipient:
The information in this internet e-mail and any attachments is confidential and may be privileged. It is intended solely for the addressee. If you are not the intended addressee please notify the sender immediately by telephone. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

When addressed to external clients any opinions or advice contained in this internet e-mail are subject to the terms and conditions expressed in any applicable governing terms of business or client engagement letter issued by the pertinent Bank of America group entity.

If this email originates from the U.K. please note that Bank of America, N.A., London Branch and Banc of America Securities Limited are authorised and regulated by the Financial Services Authority.


More information about the london.pm mailing list