Dup INSERT problem ONLY in Internet Explorer

  • I saw another thread on this forum similar but not quite the same...

    I have a simple 4 table DB in Prod and Dev and identical ASP code in Prod and Dev and this issue appears in both environments. Randomly, when I submit my form in IE using conn.excute(insertstring) the data is written to the SQL table 2 times. This ONLY occurs in Internet Explorer 6.0. I've tried 3 machines with IE to make sure it was not isolated to one PC. I have also tested it with Netscape on a PC, and Safari and IE on a Mac and it never occurs.

    I've completely stripped my form handler of everything but request.form(variables), the sql connection and the insert and ended immediately after the INSERT with a response.end() to eliminate the possibility of an error looping the form as suggested in the other thread to no avail.

    Has anybody ever seen this before?

  • OK, I'm replying to my own topic...

    Something within this Function is causing the problem....not sure why it only errs in IE though.

    function DoSubmit()

    {

    var ExpDate= new String(document.forms[0].expDate.value);

    varExpDescription= new String(document.forms[0].expDescription.value);

    var ExpCategory= new String(document.forms[0].expCategory.value);

    var ExpAmount= new String(document.forms[0].expAmount.value);

    var ExpAMEX= new String(document.forms[0].expAMEX.value);

    if ( ExpDate.valueOf()== "" )

    {

    alert("Please select a date for your expense.");

    document.expForm.expDate.focus();

    return false;

    }

    if ( ExpDescription.valueOf()== "" )

    {

    alert("Please enter a description for your expense.");

    document.expForm.expDescription.focus();

    return false;

    }

    if ( ExpCategory.valueOf()== "" )

    {

    alert("Please select an expense category.");

    document.expForm.expCategory.focus();

    return false;

    }

    if ( ExpAmount.valueOf()== "" )

    {

    alert("Please enter an amount for your expense.");

    document.expForm.expAmount.focus();

    return false;

    }

    window.document.expForm.action = "addExpense.asp";

    window.document.expForm.method = "POST";

    window.document.expForm.submit();

    }

    The Submit button contained an onClick="return DoSubmit();" and the FORM tag contained only a name like <form name="expForm">. However, when I replaced the submit onclick="return DoSubmit();" with a onclick="submit" and changed the FORM tag to <form name="expForm" method="post" action="addexpense.asp"> the anomaly disappeared.

    I know this "code" problem is probably outside of the scope of this board but I definitely need a working form handler so, if anyone has a bit of knowledge they care to share. Feel free. Otherwise, I need to find a good ASP/Javascript support group.

    THANK YOU!

  • Sorry we haven't been able to help. You might try the newsgroups that MS has, see http://www.msdn.microsoft.com.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply