Welcome to WebmasterWorld Guest from 54.196.84.221

Forum Moderators: open

Message Too Old, No Replies

Java script pop up from hidden field

     
2:49 pm on Mar 5, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:June 13, 2002
posts:108
votes: 0


I have a mail list which responds to the form input by referring to a url in a hidden field

<input type="hidden" name="subscribe" value="url/subscribe.htm">

I want to put the response in a pop up window rather than a new page i.e. "Thank you for your interest"

How do I get:

value="url/subscribe.htm">

into a new window?

3:05 pm on Mar 5, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Dec 9, 2002
posts:325
votes: 0


I presume subscribe.htm is the page your current form displays next, but is NOT the page your form currently submits to. I would expect you have something like

<form action="submit.cgi">

The only way I can think of, off the top of my head, is to use JavaScript to take all the values from your form, encode them into a format suitable for a url, and then use window.open(desturl,'windowname','windowoptions') to post to the actual form submission script. desturl would then be the url and the contents of each form element e.g.

submit.cgi?name=forename%20surname&age=25&blah=...

HTH,
JP

3:09 pm on Mar 5, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:June 13, 2002
posts:108
votes: 0


Thanks

The form action is a separate script on the server which gets the variable "subscribe" and then displays the url. I just want to put that URL in a new pop-up window.

3:12 pm on Mar 5, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Dec 9, 2002
posts:325
votes: 0


The form action is a separate script on the server which gets the variable "subscribe" and then displays the url. I just want to put that URL in a new pop-up window.

That cannot be done server side. Opening new windows can only be done through JavaScript on the client side. Therefore, see above, or get the cgi program to return the filled out form (or empty form?) but with a

OnLoad="window.open('url/subscribe.htm','','');"

in the body tag.

JP

3:42 pm on Mar 5, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:June 13, 2002
posts:108
votes: 0


Sorry, the script is a php script on the server. As it is now the confirmation page appears in a new window "subscribe.htm"

As this is pulled from the script then I presume from what you are saying that it cannot be displayed in a pop-up without altering the php script?