Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Retrieving value from HTML->Javascript->Perl

by Speedy (Monk)
on Jul 05, 2002 at 23:16 UTC ( [id://179761]=note: print w/replies, xml ) Need Help??


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

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://179761]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-19 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found