ASP Form Doesn't Always Submit

E

Eric

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
 
T

Tom B

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,075
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top