Forum Moderators: open

Message Too Old, No Replies

Open a cgi generated page in a pop-up window

javascript window.open passing variables to cgi

         

lgooley

9:22 pm on Nov 2, 2004 (gmt 0)

10+ Year Member



Here is what I am trying to do.

1) user clicks on button
2) button opens a new pop-up window (sized to my liking) and displays a page (that I have told it to) with data generated from a cgi script.

I am using a function that looks like this:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=500,left = 262,top = 134');");
}
// End -->
</script>

My button code looks like this:

<input type=button value="View HCP History" onClick="javascript:popUp('url')">

I need to pass about 5 variables from the first page to the cgi program to generate the resulting content in the pop-up window.

Where do I put the variables!? No matter what I do - I can't get it to work.

lgooley

9:29 pm on Nov 2, 2004 (gmt 0)

10+ Year Member



Oh...one more thing. I have gotten the code to work, meaning that it opens up the correct url and in a correctly sized window...I just can't get the cgi program to send me the variables.

In the initial page (where the button is) I KNOW that the hidden fields contain the info I need...I just can't get it to the pop-up.

(I removed the actually cgi program name and URL - If you need it, I will supply)

lgooley

4:08 pm on Nov 3, 2004 (gmt 0)

10+ Year Member



Ok - got the variables to show up...everything is working fine...except:

What do I have to do syntax-wise to avoid errors with names that have apostrophe's?

adni18

11:20 pm on Nov 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you should replace them with the %xx equivalent of '

lgooley

1:15 pm on Nov 4, 2004 (gmt 0)

10+ Year Member



OK - I have this list of encodes in front of me ... I would have to say (on the serverside?) that if the variable has a " ' " replace with %27 before sending back to the browser?

adni18

9:42 pm on Nov 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would try that first.

lgooley

9:46 pm on Nov 4, 2004 (gmt 0)

10+ Year Member



DANKE