Jump to content
Larry Ullman's Book Forums

JackNorrisRD

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by JackNorrisRD

  1. Larry,

     

    I have 3 of your books and am considering 2 more. Thanks!

     

    I have really been struggling with AJAX.

     

    One of the main things that is causing me problems is that Firefox insists on submitting the form(s) even when I return a "false" from the javascript. The only way I have been able to stop this is by getting rid of the submit inputs which means I have to use workarounds, like a button input, for all the scripts from your book to deal with the changes to the form. I have been able to get an autocomplete search to work, so I'm not completely failing, but this has become more problematic with the scripts to add a record to a database table.

     

    This is what I currently have for one of my scripts:

     

    record add form:

     

    <form method="post" id="member_add_form_ajax" onsubmit="member_add_xml()">

     

    <input type="submit" value="Add Member" >

     

    ..text field inputs....

     

    </form>

     

    Then for the javascript:

     

     

    function member_add_xml()

    {

    // Calls the ajax object from ajax.js

    var member_add_ajax = getXMLHttpRequestObject();

     

    // Check for ajax object; if none, don't use AJAX

    if(member_add_ajax)

    {

    // Check to see if the page has an element with an id of "results"

    if(document.getElementById('member_add_ajax_results'))

    {

    //window.alert('hello 1');

     

    return false;

    }

    }

    }

     

    It reaches the window.alert, so I know it's getting that far. But the form submits.

     

    Obviously, this code doesn't do anything, I've taken out everything between the window.alert and the return false; so that I can see if I can get the form to stop submitting without anything to trip it up.

     

    If I could at least get the form to stop submitting, I would then not have to modify your scripts so much and could possibly get it to work.

     

    Thank you for any help!

     

    Jack

×
×
  • Create New...