ASP Form Doesn't Always Submit

Discussion in 'ASP General' started by Eric, Sep 19, 2003.

  1. Eric

    Eric Guest

    Hello everyone,

    I am pretty much newbie to ASP so please bear with me as I explain my
    problem. I currently have a main form which displays data queried
    from a SQL database. From that main page I have a hyperlink which
    opens a child window and allows edits to the data displayed on the
    parent form. As the child form is submitted, it is updating the
    database, then it refreshes the parent page and closes itself. That
    all works properly, however, sometimes after pressing the update
    button nothing is submitted. It looks as though it has been submitted
    but when running 'profiler' I see that there have been no sql updates
    against the db. When I remove the window.close(performed directly
    after the submit, see below) from the child form it works everytime
    without fail. Is it possible that the form sometimes closes before
    the submit is actually finished? Any help/advice is greatly
    appreciated! Thanks!


    function updateRecord()

    'check with the user
    response=confirm("Update record?")

    if response=true then


    document.forms("editcontacts").SubmitType.value="update"
    document.forms("editcontacts").Submit()

    window.opener.location.reload()
    window.close
    end if

    end function
     
    Eric, Sep 19, 2003
    #1
    1. Advertising

  2. Eric

    Tom B Guest

    It's safer to submit the form, then on the receiving form, after all of the
    data is validated and the database updated, send the close and refresh code.



    "Eric" <> wrote in message
    news:...
    > Hello everyone,
    >
    > I am pretty much newbie to ASP so please bear with me as I explain my
    > problem. I currently have a main form which displays data queried
    > from a SQL database. From that main page I have a hyperlink which
    > opens a child window and allows edits to the data displayed on the
    > parent form. As the child form is submitted, it is updating the
    > database, then it refreshes the parent page and closes itself. That
    > all works properly, however, sometimes after pressing the update
    > button nothing is submitted. It looks as though it has been submitted
    > but when running 'profiler' I see that there have been no sql updates
    > against the db. When I remove the window.close(performed directly
    > after the submit, see below) from the child form it works everytime
    > without fail. Is it possible that the form sometimes closes before
    > the submit is actually finished? Any help/advice is greatly
    > appreciated! Thanks!
    >
    >
    > function updateRecord()
    >
    > 'check with the user
    > response=confirm("Update record?")
    >
    > if response=true then
    >
    >
    > document.forms("editcontacts").SubmitType.value="update"
    > document.forms("editcontacts").Submit()
    >
    > window.opener.location.reload()
    > window.close
    > end if
    >
    > end function
     
    Tom B, Sep 19, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page