Perhaps the problem is in getting the value of "textBox" passed in the JavaScript function call.

Try reading the value in the JavaScript function rather than passing it. This also would give you the chance to test for no value or improperly formatted values being entered.

For example, in your HTML code, try something like:

<html> <head> <script language="JavaScript"> function priceList () { var text=form.textBox.value; win=window.open("/cgi-bin/getPrice.pl?textBox="+text,"","width=250,hei +ght=240") } </script> </head> <body> <form name='form'> <input type="text" name="textBox" size="8"> <a href="javascript:priceList();">Price List</a> </form> </body> </html>

with about the same Perl script, for example:

#!/usr/bin/perl use strict; use warnings; use CGI; my $q = new CGI; my $partNumber = $q->param('textBox'); print $q->header, $q->start_html; print $q->p("Part Number = $partNumber"); print $q->end_html;

The pop-up window then contains the value entered.

Speedy

Live in the moment


In reply to Re: Retrieving value from HTML->Javascript->Perl by Speedy
in thread Retrieving value from HTML->Javascript->Perl by peacemaker1820

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.