Javascript - Onsubmit problem in Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bubs81
    New Member
    • Jun 2009
    • 1

    Javascript - Onsubmit problem in Firefox

    Hi,

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

    Code:
    <form target="_self" onsubmit="return preProcessForm();" action="somewhere" method="post">
    preProcessForm looks like...

    Code:
    function preProcessForm()
    {
    var url = "pre_process_form.php";
    
    run_AJAX_Request(url);
    
    return true;
    }
    I am trying to get pre_process_for m.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_for m.php has finished. Can anyone suggest something?
    Last edited by acoder; Jun 28 '09, 09:49 PM. Reason: Added [code] tags
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    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

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      What does pre_process_for m 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?

      Comment

      Working...