Connecting Tech Pros Worldwide Forums | Help | Site Map

Javascript - Onsubmit problem in Firefox

Newbie
 
Join Date: Jun 2009
Posts: 1
#1: Jun 27 '09
Hi,

Here's the first line of my HTML form...

Expand|Select|Wrap|Line Numbers
  1. <form target="_self" onsubmit="return preProcessForm();" action="somewhere" method="post">
preProcessForm looks like...

Expand|Select|Wrap|Line Numbers
  1. function preProcessForm()
  2. {
  3. var url = "pre_process_form.php";
  4.  
  5. run_AJAX_Request(url);
  6.  
  7. return true;
  8. }
I am trying to get pre_process_form.php to run in the background (using AJAX), prior to submitting the form. It works fine every time in IE 7/8, and it works 80% of the time in Firefox 3.0.11.

The problem occurs when the user submits the form. They are navigated to the appropriate destination, however, 20% of the time, the AJAX function appears to have not been called or the php script doesn't seem to have been called. I suspect this might be a FF bug but I'm trying to achieve some sort of short term work-around. The idea is - submit the form when pre_process_form.php has finished. Can anyone suggest something?

Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,188
#2: Jun 28 '09

re: Javascript - Onsubmit problem in Firefox


I have moved your post to the correct forum, Javascript / AJAX. Please try to post in the correct forum using the links from the Topic menu as you will get a more rapid response if you do.

Banfa
Administrator
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Jun 28 '09

re: Javascript - Onsubmit problem in Firefox


What does pre_process_form do? If you're going to submit anyway (as in, a refresh/reload/unload of the page will take place), why not run this code in the action page?
Reply


Similar JavaScript / Ajax / DHTML bytes