Perl, javascript and CGI

Discussion in 'Perl Misc' started by Saya, Sep 5, 2003.

  1. Saya

    Saya Guest

    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 ?
    Saya, Sep 5, 2003
    #1
    1. Advertising

  2. Saya

    Mark Guest

    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, (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 ?
    Mark, Sep 5, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jürgen Exner

    Re: CGI Perl "use CGI" statement fail

    Jürgen Exner, Jul 31, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,254
    Jürgen Exner
    Jul 31, 2003
  2. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    533
    Michael Sparks
    Jul 30, 2005
  3. excord80
    Replies:
    17
    Views:
    632
    J Kenneth King
    Jan 29, 2009
  4. shumsta
    Replies:
    1
    Views:
    254
    Fabian Pilkowski
    Jul 22, 2005
  5. kath
    Replies:
    4
    Views:
    561
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page