http://www.perlmonks.org?node_id=179901


in reply to Retrieving value from HTML->Javascript->Perl

The following screams at me from your code:
win=window.open("cgibin/getPrice.pl?textBox="+text,"","width=250,heigh+t=240")

Should read:
win=window.open("cgibin/getPrice.pl?textBox='+text+' ","width=250,height=240")

See the difference?

TexasTess
  • Comment on Re: Retrieving value from HTML->Javascript->Perl

Replies are listed 'Best First'.
Re: Re: Retrieving value from HTML->Javascript->Perl
by dws (Chancellor) on Jul 07, 2002 at 00:30 UTC
    Should read:
    win=window.open("cgibin/getPrice.pl?textBox='+text+' ","width=250,height=240")

    Nope. Not unless the CGI expects the string to arrive with single quotes around it. I suspect that the right thing to do here is to URL-encode 'textBox', via

    win=window.open("cgibin/getPrice.pl?textBox=" + escape(text), "width=250,height=240")
      I've just written some code almost exactly like this..but it's at work and I'm at home..and my brain is fried so can't remember the EXACT syntax I used however....

      I've found that when trying to use quotes inside a quoted string the CGI converts the ' nicely...but leave the " in and it screws it up...ALSO shouldn't there be a "+" on either side of the variable?
      Texas Tess