Submit not returning to the server

D

Deidre

I am having a weird problem. I have an application thats default.aspx
page is a menu page when a menu item is selected the requested page is
loaded into default.aspx using iframes. When unsaved changes have been
made to the iframe page and a user selects another item from the
default.aspx menu I want to prompt the user to see if they want to
save changes before going to the selected page.
The problem I am having is that the client form submit call is not
causing the server to be called - unless I put a message box after the
submit. I don't need this message box here but if I remove it the
iframe changes to the selected page without saving the change even if
the use selected to save changes.
Here is the code I am using:
Default.aspx - Client Code
Function MenuHome() 'note this function is called by the onclick event
of the menu item
Dim sSource
sSource = "home.aspx?" & _
"ContactId=" & mlContactId & _
"&FirstName=" & msContactFirstName & _
"&LastName=" & msContactLastName & _
"&UserLevel=" & miUserLevel & _
"&NetUserId=" & msNetUserId & _
"&UserType=" & msUserType

If mbDirty Then
'save changes first before proceeding to selected menu
If InStr(1, iframe.location, "ActionStep.aspx") > 0 Then
iMsgboxResult = MsgBox(PENDING_CHANGES, vbYesNoCancel +
vbQuestion, "Action Step")
If iMsgboxResult = vbYes Then
'call the savechanges of the loaded page
iframe.SaveChanges
MenuClick(sSource)
ElseIf iMsgboxResult = vbNo Then
MenuClick(sSource)
ElseIf imsgboxresult = vbCancel Then
'do nothing
End If
Else
MenuClick(sSource)
End If
Else
'go the selected menu
MenuClick(sSource)
End if
End Function

Function MenuClick(sDest)
f.src = sDest
End If
End Function
Iframe page -Client Code
Function SaveChanges()
document.frmActionStep.action = document.frmActionStep.action &
"&Save=Y"
document.frmActionStep.submit
msgbox "Temp Saved" 'note this is what makes it work ???
End Function
Iframe page - Server Code
Page_Load
If Request.QueryString("Save") = "Y" Then
miSaveSuccess = IIf(SaveRecord(), 1, 0) 'note SaveRecord is the
function that actually saves the changes to the database.
Return
End If

Any help would be greatly appreciated.
Thanks in advance,
Deidre
 
D

Deidre

I am still having problem with this. It's driving me crazy!
It also working most of the time if I do 3 form submits one right
after the other. It seems to be a timing thing but I don't think there
is a function in vbscript like the vb function DoEvents. Is there?
Thanks,
Deidre
 
D

Deidre

I adding this after the submit and it fixed the problem:
start = timer : while timer-start < .2 : wend
I tried several other things but this was the only thing that seemed to work.
Deidre
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top