Perl, javascript and CGI

S

Saya

Hi,

I have the following scenario in a system that we run. From a webpage
using javascript I am able to invoke a *.ipl script on the server and
pass parameters as well:

javascript param parsing:
parameters = new Object();
parameters.iw_arrArtikelIDs = arrArtikelsToExtract;
callServer("test.ipl", parameters, true);

*.ipl param extraction:
my${cgi} = new CGI();
my $arrArtikelIDs = ${cgi}->param('iw_arrArtikelIDs');

The issue here is that arrArtikelsToExtract is a java array containing
ID's that I need to process in the *.ipl script. I can't seem to get
it to work.
I thought I was so lucky that I could get away with saying something
like the below in the *.ipl script:
my @arrArtikelIDs = ${cgi}->param('iw_arrArtikelIDs');

Does anyone have any hints/clues/way(s) of achieving this. Parsing an
array from javascript to an ipl script ?
 
M

Mark

Hi Saya,

I am not an expert at these things but you might want to try this perl
code to get hold of the parameters. It does not require you to specify
the parameters by name

######Get the data from the form
my $query = new CGI;
my @keywords = $query->param;
my $sizeKeywords = @keywords;

#####put key value pairs returned from form into a hash
my %values;
foreach my $val(@keywords){
$values{$val} = $query->param("$val");
}

If its the javascript that is not operating as expected, what about
using a document.write statement to write a form action url with
keyvalue pairs attached or to write hidden inputs within the form with
each value of the array in a seperate input?

Hope that helps,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top