Forum Moderators: phranque

Message Too Old, No Replies

Javascript Question

Add hidden fields tpo a form in new window

         

carfac

7:51 pm on Apr 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi:

Have a javascript question. I am using the following code to open a small pop-up to get user input:

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
function openpopup(){
var popurl="http://www.mydomain.com/edit.cgi"
winpops=window.open(popurl,"","width=350,height=175,status,resizable,")
}

That works well... no problem. But I need to pass a couple variables to edit.cgi in the process. In a form, I would just add:

<INPUT NAME="g" TYPE="hidden" VALUE="XXXXXX">
<INPUT NAME="user" TYPE="hidden" VALUE="$username">

Can I- and how do I?- add these hidden variables to be passed to the script when I open with this sort of javascript?

THANKS!

Dave

dmorison

8:10 pm on Apr 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi

You should be able to pass anything to edit.cgi in the URL - in your case something like:

var popurl="http://www.mydomain.com/edit.cgi?g=XXXXXXXX&user=$username"

They will be available to edit.cgi however your scripting language lets you get at GET variables.

carfac

8:33 pm on Apr 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



dmorison:

Thanks... I had been using that- and it works. I was just hoping I could submit those "hidden" to clean things up a bit!

dave