473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

form is double-submitting when opening a new window

the customer I'm developing a site for uses a canned form-parsing page that
allows her to have an email subscription opt-in page add emails to a list
she can manage using a link that you point your HTML form to. the actual
form-parsing page resides on a server that's uneditable to me since it sits
on an inaccessible server.

my problem is more irritating than anything; everything double-submits..

when you submit the form, I've forced a new window to open (using
"target='_blank'" in the FORM tag)
So it works- a new window opens saying "Thank you for signing up [followed
by a JS "close this window" option]

however, it's popping up a 2nd window on top of this first popup with this:
"This address already exists in this list. This record will be updated with
any new information entered."

if I ease up on the need to have the form submit to a new window & have it
just submit to the link within the same original window, this apparent
double-submission doesn't happen, but it kicks people off the site because
this canned form-processing page that the form must point to is very
generic. All it says is "Thank you for submitting" followed by a JS
close.window link saying "Close this window".. and the problem w/ doing it
this way is, when you close the window, you're then closing the browser and
kicking the viewer off of the web site.... pretty annoying from a user's
POV. That's why I need to force the new window.

2 more things
--the JS must run it's client-side error-checking
--using "POST" form method rather than GET so they're passed as form
variables not URL variables
Here is the code...............
You can either go to http://www.smoochya.com/index_matt.htm and view the
source code or look at what I've cut & pasted here... this is the relevant
code to the form-submission page:

*********
function submitForm()
{
var continueToSubmit = true;
if( continueToSubmit && document.optin.OILB_124077.value.length == 0 )
{
continueToSubmit = false;
alert('You must provide a value for AGE.');
document.optin.OILB_124077.focus();
}
if( continueToSubmit && document.optin.OILB_EMAIL.value.length != 0 )
{
var emailValue = document.optin.OILB_EMAIL.value;
if( ( emailValue.indexOf( '@' ) <= 0 ) || ( emailValue.indexOf( '.',
emailValue.indexOf( '@' ) ) <= 0 ) )
{
continueToSubmit = false;
alert('You must provide a valid email address.');
document.optin.OILB_EMAIL.focus();
}
}
if( continueToSubmit && document.optin.OILB_EMAIL.value.length == 0 )
{
continueToSubmit = false;
alert('You must provide a value for EMAIL.');
document.optin.OILB_EMAIL.focus();
}
if( continueToSubmit && document.optin.OILB_FIRSTNAME.value.length == 0 )
{
continueToSubmit = false;
alert('You must provide a value for NAME.');
document.optin.OILB_FIRSTNAME.focus();
}
if( continueToSubmit )
{
document.optin.submit();
}

************

Here is the code to the form tag in the body of the same page:

<FORM NAME='optin' METHOD='POST'
ACTION='http://postsnet.com/app/campaigner/services/optinlist/processoptinre
quest.jsp?oilb=84884235' TARGET="_blank">

**************
And here is the code to the 2nd pre-fabbed form processing page that pops up
saying "this address already exists in this list"

<HTML><HEAD><TITLE>Newsletter Sign Up Form</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
//Determine which CSS file to use
var browser = navigator.appName;
var browserVersion = navigator.appVersion;
var ver5Browser = browserVersion.indexOf("MSIE 5");
var os = navigator.platform;
var ie = "Microsoft Internet Explorer";

var netscape = "Netscape";
var mac = "MacPPC";

var newdoc="";
var newRootString="";
var oldRootString="http://postsnet.com/campaigner_images";
var oldSecureRootString="https://postsnet.com/campaigner_images";
var rootString = document.URL;

// check which protocol the page is, http or https and choose the
appropriate style sheet.
if( rootString.indexOf("https") > 0)
{
newRootString= oldSecureRootString;
}
else
{
newRootString= oldRootString;
}

if(browser == netscape && os != mac)
{
newdoc="<link rel=stylesheet type='text/css'
href="+newRootString+"/Scripts/main_nn_pc.css title=master>";
}
else if(browser == netscape && os == mac)
{
newdoc="<link rel=stylesheet type='text/css'
href="+newRootString+"/Scripts/main_nn_mac.css title=master>";
}
else if(browser == ie && ver5Browser < 0 && os == mac)
{
newdoc="<link rel=stylesheet type='text/css'
href="+newRootString+"/Scripts/main_ie_mac.css title=master>";
}
else if(browser == ie && ver5Browser >= 0 && os == mac)
{
newdoc="<link rel=stylesheet type='text/css'
href="+newRootString+"/Scripts/main_ie5_mac.css title=master>";
}
else
{
newdoc="<link rel=stylesheet type='text/css'
href="+newRootString+"/Scripts/main_ie_pc.css title=master>";
}
document.write(newdoc);
</SCRIPT>

</HEAD>
<BODY BGCOLOR='#FFFFFF'>
<font class='rhmaincopy'><B>Thank you!</B><BR><BR>This address already
exists in this list. This record will be updated with any new information
entered.<BR><BR><A HREF='javascript:window.close();'>close window</A><BR>
</FONT></BODY>
</HTML>
********************************8

Maybe this is something I can't control or even see since it's on some site
that makes (bad) cookie-cutter form parsing pages for a site to point it's
form to... . but if anyone has any ideas for workarounds....

Thanks in advance,
Matt
Jul 20 '05 #1
1 3733
"Display Name" <mm*****@nyc.rr.com> wrote in message news:<ko*****************@twister.nyc.rr.com>...
the customer I'm developing a site for uses a canned form-parsing page that
allows her to have an email subscription opt-in page add emails to a list
she can manage using a link that you point your HTML form to. the actual
form-parsing page resides on a server that's uneditable to me since it sits
on an inaccessible server.

my problem is more irritating than anything; everything double-submits..

when you submit the form, I've forced a new window to open (using
"target='_blank'" in the FORM tag)
So it works- a new window opens saying "Thank you for signing up [followed
by a JS "close this window" option]

however, it's popping up a 2nd window on top of this first popup with this:
"This address already exists in this list. This record will be updated with
any new information entered."

It's because the <form> element is submitting the form, then your
JavaScript function does it, too. Change this

if( continueToSubmit )
{
document.optin.submit();
}

to

if( continueToSubmit )
{
document.optin.submit();
} else return false;
--
Hywel
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex Glass | last post by:
I have read plenty about applying double buffering for animation and self drawn forms. Is there a way to apply it to a form with many standard controls on it (textboxes, labels etc) ?? I have...
1
by: edself | last post by:
I have a form which displays a subform datasheet of information. I'd like to be able to quickly click on a particular record and open up another form showing more detailed information about that...
3
by: N. Graves | last post by:
Hello, I'm having trouble with a feature that I would like to add to my database. I would like to have the ability to double click a record on a Sub form and that action would open that...
2
by: harvie wang | last post by:
Hi, I want to implement a common Form with special interface, such as MovePoint(double,double). I create a interface first: namespace ABC.Test { public Interface IMyWindowInterface { void...
9
by: removeps-generic | last post by:
I have struct X { double array; }; I want to form a pointer to the 5th element of X::array. The type of the pointer should be "double X::*" or "double* X::*" or something along those...
9
by: oz | last post by:
Hi All, I want to make a dictionary with windows application. My data is html format. therefore, i use webBrowser control on my windows form. If the user click any word in webBrowser control,...
5
by: Lyn | last post by:
I thought that in an earlier project I was able to click or double-click in the detail section of a row in a continuous form and use the event to open a detail form for that row. However, now a...
3
by: 2myle | last post by:
Hello experts, Sorry, this is probably a newbie-question... I have a form for customer details, which includes a subform (datasheet, multiple columns) that lists the orders that correspond to...
3
by: David | last post by:
Hi, I have some code in my form as follows, to display 1 to 20 additional sets of fields to enter guest information. I am not sure how to retrieve these guests info so that I can post the info...
14
by: BASSPU03 | last post by:
(I'm using Access 2003 on a Windows XP O/S.) I've gotta present an update on my database this week--possibly within the next 24 hours. A solution or guidance to this inquiry would really, really...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.