473,699 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FireFox submitting form twice

3 New Member
I have a couple of forms that are misbehaving in FireFox, but work fine in IE.

when i do submit( with submit button) a javascript function validates all of the fields entered, and stops the submission if there is an error.

Sample (obviously not working code):
[HTML] <html>
<head>
<script type="text/javascript">
function Submit()
{
// do something, like form field validation before submitting
return true;
} else {
return false; // do nothing, do not submit the form
}
}
</script>
</head>
<body>
<form name="myForm" action="form.cg i" onSubmit="retur n Submit()>
Some form fields here<br/>
<input type="submit" value="Submit" >
</form>
</body>
</html>
[/HTML]



THE PROBLEM:
In IE, the script performs as expected.

In FireFox (tested in v2.0.0.3):
* if the form validates correctly, it gets submitted twice:
* if the form doesn't validate then nothing happen.

Am I coding something wrong here? Why is FireFox submitting the form two times..
Apr 24 '07 #1
18 13130
r035198x
13,262 MVP
I have a couple of forms that are misbehaving in FireFox, but work fine in IE.

when i do submit( with submit button) a javascript function validates all of the fields entered, and stops the submission if there is an error.

Sample (obviously not working code):
<html>
<head>
<script type="text/javascript">
function Submit()
{
// do something, like form field validation before submitting
return true;
} else {
return false; // do nothing, do not submit the form
}
}
</script>
</head>
<body>
<form name="myForm" action="form.cg i" onSubmit="retur n Submit()>
Some form fields here<br/>
<input type="submit" value="Submit" >
</form>
</body>
</html>



THE PROBLEM:
In IE, the script performs as expected.

In FireFox (tested in v2.0.0.3):
* if the form validates correctly, it gets submitted twice:
* if the form doesn't validate then nothing happen.

Am I coding something wrong here? Why is FireFox submitting the form two times..
I'm not a FireFox guru and am just trying my luck here,
What happens if you call the function onClick of the submit button rather than onSubmit of the form?
Apr 24 '07 #2
wgale025
23 New Member
try to change the function name
Apr 24 '07 #3
r035198x
13,262 MVP
try to change the function name
Of course. That should be it.
Apr 24 '07 #4
NavinM
3 New Member
i tried to use onclick and the results are same.
btw, onclick event will take care of only mouse click.
but i need to make it generic,
I want to use all three cases.
a) submitting page by enter.
b) submitting page by click
c) submitting page by space when control is on submit button,

i have tried with changing function but no luck.

is there any other way, i can look on.

Thanks
Apr 25 '07 #5
r035198x
13,262 MVP
i tried to use onclick and the results are same.
btw, onclick event will take care of only mouse click.
but i need to make it generic,
I want to use all three cases.
a) submitting page by enter.
b) submitting page by click
c) submitting page by space when control is on submit button,

i have tried with changing function but no luck.

is there any other way, i can look on.

Thanks
Can you post the code you have now with the function name changed
Apr 25 '07 #6
Grimm
4 New Member
Firefox automaticqally follows the submit standard function after an event has occured when using a submit button...if you change the button type to button instead of submit and change the function name it will work normally. Unfortunatley you loose some of the other funtionality options you want but give a little to get a little. Sorry
Apr 25 '07 #7
NavinM
3 New Member
Firefox automaticqally follows the submit standard function after an event has occured when using a submit button...if you change the button type to button instead of submit and change the function name it will work normally. Unfortunatley you loose some of the other funtionality options you want but give a little to get a little. Sorry

i found the solution afterall :)
the page was being loaded with GET method and issue was -- " mismatching of character encoding" ( hence GET was being executed Twice )
i used Central European ISO-8859-2 and everything is working fine

refer the below link for more details ..
http://forums.mozillazine.org/viewto...859258#2859258

Regards
Navin
Apr 26 '07 #8
Dashboard
6 New Member
I'm still getting the problem. I've checked and set the charset encoding on the response header but with no luck [UTF-8]. FF still issues a Post and then a Get. Could someone please detail out how the solution is working for them.

One thing to note is that I use javascript to submit my form onchange of a text field. That should not make a difference.

The page meta tags -
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Pragma" content="nocach e"/>
<meta http-equiv="Cache-Control" content="privat e"/>
<meta http-equiv="Cache-Control" content="proxy-revalidate"/>

Note I tried with the following as well -
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Pragma" content="no-cache,no-store,max-age=0"/>
<meta http-equiv="Cache-Control" content="nocach e"/>

In my servlet I set the following

response.setHea der("Pragma", "No-cache");
response.setHea der("Cache-Control", "no-cache,no-store,max-age=0");
response.setHea der("Content-Type", "text/html; charset=UTF-8");
response.setDat eHeader("Expire s", 1);


Am I doing something wrong here?
May 9 '07 #9
acoder
16,027 Recognized Expert Moderator MVP
I'm still getting the problem. I've checked and set the charset encoding on the response header but with no luck [UTF-8]. FF still issues a Post and then a Get. Could someone please detail out how the solution is working for them.

One thing to note is that I use javascript to submit my form onchange of a text field. That should not make a difference.

The page meta tags -
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Pragma" content="nocach e"/>
<meta http-equiv="Cache-Control" content="privat e"/>
<meta http-equiv="Cache-Control" content="proxy-revalidate"/>

Note I tried with the following as well -
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Pragma" content="no-cache,no-store,max-age=0"/>
<meta http-equiv="Cache-Control" content="nocach e"/>

In my servlet I set the following

response.setHea der("Pragma", "No-cache");
response.setHea der("Cache-Control", "no-cache,no-store,max-age=0");
response.setHea der("Content-Type", "text/html; charset=UTF-8");
response.setDat eHeader("Expire s", 1);


Am I doing something wrong here?
What's the character encoding in your browser?
May 9 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
16028
by: fogwolf | last post by:
First a basic outline of what I am trying to do: I want to have a page spawn a pop-up when you click "submit" on its form. On this pop-up page there will be another form. When you click "submit" on the pop-up's form I want the pop-up to close & a new page to load in the "parent" window/page. I have this working in IE but cannot get it to work in Firefox. The parent window correctly loads the new page after submitting from the pop-up,...
1
1962
by: chad.arimura | last post by:
I've got a form inside a PHP script that posts to itself, does some processing on the PHP side, and if it looks good, PHP sends a HEADER command that redirects the user out. All was fine until I added a button disabler onSubmit to keep users from submitting twice. Now the form disables the button as requested but just refreshes the page... it doesn't get to the HEADER command. Any idea what the problem might be? <script...
24
3501
by: bedhead | last post by:
Why doesn't a SELECT element's innerHTML reflected which option was selected? Works in IE. I need this functionality so that I can retain what choices a user made in a tabbed interface. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://w3.org/1999/xhtml"> <head> <script language="javascript">
4
1671
by: Nacho Nachev | last post by:
This may sound like a silly question, but what is the appropriate way to handle form double submitting in ASP.NET. Page expiration, etc? I am looking for a way to handle this in some cetral point of the application without affecting the web page implementation. Thanks, Nacho
6
14457
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the postback code, but I have a workaround for that installed (and it looks like the code generated by ASP.NET when it renders the page does the same thing, namely, setting document<). However, the problem still exists under firefox. Has anyone come...
5
4333
by: Andrea | last post by:
I am trying to alter css using javascript as well as use the innerHTML function. I have pasted below 3 forms that access getElementById in slightly different ways (I wanted to rule out that it was the method.) All 3 work fine on IE but only work momentarily on Firefox. For example, one form has text that changes from red to black when the user clicks the button. In IE it changes. In Firefox it changes for a split second then goes back...
1
2089
by: gferreri | last post by:
Hi all, I've stumbled on an interesting problem with the way Firefox handles form submitting with the enter key. I'm putting together a page that has one form element with multiple controls with their own textbox field and submit imagebuttons. I've set up each control in an asp:Panel with their DefaultButton property set to the proper button, so when the enter key is pressed, the proper button event handler is triggered. This works...
7
8356
by: mohammed.naghman | last post by:
Hi, I have 2 submit buttons in a jsp page. One of them takes me to page2.jsp and also passes the values enetered to page2.I have a link in the page2 that does a history.back to come to the previous page to make any chnages necessary. Now after making my changes, instead of going to page2.jsp if I want to submit the page, Instead of submitting the page it takes me to page2.jsp again. This problem is only with firefox. It works fine...
9
2893
by: Ned White | last post by:
Hi All, Im my c# web project, users click a submit button for credit card payment process. On the web server side ( on ButtonClick_Event) the user's input(name,date,cc number etc.) is processed and some transactional database processes are taken based on the inputs. My problem is, users may think that the button click did not work, so they can click it again and again or they can refresh the all page by pressing
0
9173
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8882
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6533
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5872
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.