Forum Moderators: open

Message Too Old, No Replies

Script works in Firefox but not IE

popup confirmation form in seperate window

         

kgplumb

10:31 pm on Feb 11, 2006 (gmt 0)

10+ Year Member



Hi,

I am re-doing a web site for a client and he wants to have a form on his home page so that visitors can be added to a data base and receive an email newsletter.

Once the visitor enters their information and clicks "submit" they are redirected to a confirmation page that has a "back" button to return them to where they came from. With this site we want to have the confirmation page pop-up in a small separate window.

I have got this to work with Firefox beautifully but when I try the form in Internet Explorer the confirmation page does not pop-up but is displayed in the same window as the form.

I only know enough about Java to copy and paste and am at a loss as to how to get the form confirmation pop-up work in IE. I have tried everything I can think of (which admittedly is not much) to get it to work.

Can someone offer any suggestions please?

Thanks!

[edited by: DrDoc at 10:50 pm (utc) on Feb. 11, 2006]
[edit reason] Removed references. See TOS. [/edit]

DrDoc

10:51 pm on Feb 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

Simply set the target attribute on your form to

_blank

And, by the way: it is JavaScript, not Java. The two are very different and are not related (just like every Smith in the USA is not a relative of the other).

kgplumb

10:56 pm on Feb 11, 2006 (gmt 0)

10+ Year Member



Thanks for the reply.

Sorry to be a simpleton but I'm not sure where to put the code you are suggesting. Here is the code from the form that works in Firefox but IE.
Would you tell me where I need to put the code to make it work in IE?

Thanks so much for your help.

<SCRIPT>
<!-- Privacy policy -->
function open_window(url) {
mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=250,height=280,left=262, top=144');
}
</SCRIPT>
<SCRIPT TYPE=" text/javascript" >
<!--
function popupform(myform, windowname)
{
if (! window.focus)return true;
window.open(' YOUR POPUP PAGE HERE' , windowname, ' height=420,width=628,scrollbars=no' );
myform.target=windowname;
return true;
}
//-->
</SCRIPT>

<form action="http://example.com/cgi-bin/formsubmit.cgi" name=" " onSubmit=" popupform(this, ' join' )" >
Name:<br>
<input name="Name" size="23"><br>
Email Address:<br>
<input type=text name="Email" value="" size="23"><br>
<input type=submit value="Submit">
<input type=hidden name="do" value="add_lead_external">
<input type=hidden name="Username" value="nlhc">
<input type=hidden name="Stop_Status" value="Active">
<input type=hidden name="Cycle_Number" value="0">
<input type=hidden name="Success_URL" value="http://example.com/success.htm">
<input type=hidden name="Failure_URL" value="http://example.com/failure.htm">
</form>

[edited by: DrDoc at 11:01 pm (utc) on Feb. 11, 2006]
[edit reason] Stripping out unnecessary code. Examplifying URLs. See TOS. [/edit]

DrDoc

11:02 pm on Feb 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps it's the space in the window name that does it?

Lobo

2:30 am on Feb 12, 2006 (gmt 0)

10+ Year Member



Having a space in the window name does make a difference, although I don't see that in the example, I'm assuming that has been edited out now?

If you do have 2 words then high case the first letters .. eg: MyExample

DrDoc

5:23 am on Feb 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's a space in the window name in the above example. The window name passed to the function is '
 join
'

a1call

5:53 am on Feb 12, 2006 (gmt 0)

10+ Year Member



Hi kgplumb,
Your form is named: " "
The function is setting the target of something called: "myform"

Perhaps IE figures out that you are talking about the only form and ff doesn't.

DrDoc

6:07 am on Feb 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's not the problem. The keyword
this
is passed to the function (which then gets assigned to the variable
myform
and becomes an object pointing to the form).

I bet the space in the window named passed to the function is the problem. At least I would try that first.

kgplumb

5:00 pm on Feb 12, 2006 (gmt 0)

10+ Year Member



Hi,

Thank you all for taking the time to look at my problem. I can't find the space that you are talking about.
Would you please copy and paste the part of the script I need to change into a reply so that I can see exactly.

I am not familiar with javascript terms.

Thanks again!

DrDoc

6:25 pm on Feb 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Change your second script to:

<script type="text/javascript" >
function popupform(myform, windowname)
{
if (! window.focus)return true;
window.open('YOUR POPUP PAGE HERE' , windowname, 'height=420,width=628,scrollbars=no');
myform.target=windowname;
return true;
}
</script>

Change the

onsubmit
in your opening form tag to:

onsubmit="popupform(this, 'join')"

kgplumb

8:22 pm on Feb 12, 2006 (gmt 0)

10+ Year Member



DrDoc you are a genius!

Thank you so much, the form now works in IE too.

I can't tell you how many hours (days) I have spent trying to figure this out.

Thanks again