Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Perl, javascript and CGI (http://www.velocityreviews.com/forums/t882293-perl-javascript-and-cgi.html)

Saya 09-05-2003 01:03 PM

Perl, javascript and CGI
 
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 ?

Mark 09-05-2003 03:06 PM

Re: Perl, javascript and CGI
 
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



On 5 Sep 2003 06:03:52 -0700, vahu@novonordisk.com (Saya) wrote:

>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 ?




All times are GMT. The time now is 07:46 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.