Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Perl & javascript

by ant (Scribe)
on May 14, 2001 at 17:06 UTC ( #80194=perlquestion: print w/replies, xml ) Need Help??

ant has asked for the wisdom of the Perl Monks concerning the following question:

Hi
I'm trying to create a form in the original broswer window
that is only submitted once all the info is entered.
I am then using child windows to execute Perl scripts to
access a database using the values entered in the child form
and return the values from the DB back to the main parent
window. This part is ok.
But how do you get a javascript variable sitting in a
HTML textbox from the parent window into a child window Perl
script as a Perl Value.

Any Ideas???
Thanks for any help in advance

Ant

Replies are listed 'Best First'.
(ar0n) Re: Perl & javascript
by ar0n (Priest) on May 14, 2001 at 17:14 UTC
    You can pass it along as a cgi param in the url when you open the window:
    MyWin = window.open("http://foo.com/cgi-bin/foo.cgi?param1=" + documen +t.forms[0].param1.value, "ChildWindow");
    Then just access it in your Perl script via CGI.

    ar0n ]

      Thanks for the prompt reply
      Your answer was spot on.
      Cheers
      Ant
Re: Perl & javascript
by suaveant (Parson) on May 14, 2001 at 17:30 UTC
    Something else you might try, which I've done before, to make things more transparent you could have a small frame to the side or in the corner that you call your perl script in, it is nice and transparent if you don't need the user to interact in that window... that way you don't drive the user crazy with popups...
                    - Ant
Re (tilly) 1: Perl & javascript
by tilly (Archbishop) on May 14, 2001 at 17:58 UTC
    I would have hidden form elements in the child window and populate them with JavaScript.

    Note that this works fine no matter what form submission method you choose.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2023-01-31 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?