#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Pennsylvania, USA
    Posts
    37
    Rep Power
    15
    I regularly make use of the technique of building and automatically submitting forms within a cgi-script. This is done to switch from one script to another when there is processing that has to be done after the last "physical" form submit - and to prevent providing parameters via a URL string (making them hidden fields instead).
    My problem is that when this is done, I get an error in Netscape - 'transfer interrupted'. It still continues, but the message is confusing to the visitor. Does anyone know a way around this?

    Example:
    A person submits credit card information on a screen. My script needs to save that information before moving on to the credit card processor - but we don't want to display another intermediate form. So - I save the information, then build a form with hidden fields, and do a javascript form.submit to automatically submit it the the Credit Card processor. This works fine in IE (and WORKS in Netscape except for the fact that a 'Transfer Interrupted' message appears on the page).

    Any suggestions? I've tried putting a delay timer on the form.submit - but that doesn't help.

    Thanks,
    Sharon
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    9
    Rep Power
    0
    this message appear in Netscape if you interrupted generation of document. probably, you call fuction which submits form within body of document, for example after definition of form. try to place call to event handler of document. i mean call your function by event 'onLoad' on body of document. little example:

    <script language="JavaScript">
    function submitForm()
    {
    var f = document.forms["myForm"];
    ...
    f.submit();
    }
    </script>

    <body bgcolor="#FFFFFF" onLoad="submitForm()">
    ...
    <form name="myForm" action="...">
    ...
    </form>
    ...
    </body>

    ------------------
    xeon
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Pennsylvania, USA
    Posts
    37
    Rep Power
    15
    Thanks xeon! I tried it in one of my smaller scripts and it worked! To be honest, it didn't make sense to me that it would work - because if you submit the form on the load of the body - it didn't seem like it would have the data loaded in the hidden fields within the form. What I had been doing was simply executing the javascript form.submit AFTER the end body tag (after $q->end_html). That seems like it would not be interrupting the document doing it that way - but apparently it was.
    Thanks again! I'll try this in some of my other scripts and will let you know if it doesn't work anywhere.

    You're a life saver!


IMN logo majestic logo threadwatch logo seochat tools logo