I'm team lead on an intranet application that uses lots of modal dialogs,
and I can tell you that "Submit"s don't work. What you have to do is have a
script that concantenates all the values together from the form when the
"submit" button is clicked, assigns that value to a variable and returns it
before closing the window. The hardest part is coordinating what's sent
back and forth, and what's processed.
So, you've got the right idea, with one two many steps. Take a look:
<form>
<!-- various input fields here... -->
<input type=button value="Submit" onClick="submit Button_OnClick" >
<!-- notice: type="button" NOT type="submit" -->
</form>
<script language="javas cript" type="text/javascript">
function submitButton_On Click(){
// the form is never submitted
frm = document.forms[0]
sTemp = 'email=' + frm.email.value
sTemp += "&fname=" + frm.fname.value
sTemp += "&lname=" + frm.lname.value
sTemp += "&open=" + frm.openContact .checked
returnValue = sTemp
window.close()
}
</script>
Hope this helps,
- Wm
"Joel" <jo******@msdn. com> wrote in message
news:08******** *************** *****@phx.gbl.. .
Hi there,
My original window (A) opens a modal dialog window (B).
In B, you fill out a form and submit it to itself for
processing. When B reloads, it knows that is successfully
processed the form and it suppose to close itself after
returning "1" or "0" to A.
My problem is that B will never close. When I submit it,
it kind of opens a new window and close that one before
return to itself (B).
Here is a code sample:
A
---
function newEntry(){
var sReturn=window. showModalDialog ('b.asp');
alert(sReturn);
}
B
---
<%@LANGUAGE="VB SCRIPT" CODEPAGE="1252" %>
<%
dim bSave
bSave=Request.Q ueryString("sav e")
if bSave="1" then
'process
end if
%>
...
function init(bSave){
if(bSave=='1'){
window.returnVa lue=bSave;
window.close();
}
}
...
<body onLoad="init('< % Response.Write( bSave)%>');">
....
<form id="b" name="b" action="?save=1 " method="post"
target="_self">
...
Any idea ?