473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

showModalDialog and submit

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="VBSCRIPT" CODEPAGE="1252"%>
<%
dim bSave

bSave=Request.QueryString("save")
if bSave="1" then
'process
end if
%>
....
function init(bSave){
if(bSave=='1'){
window.returnValue=bSave;
window.close();
}
}
....
<body onLoad="init('<% Response.Write(bSave)%>');">
.....
<form id="b" name="b" action="?save=1" method="post"
target="_self">
....

Any idea ?
Jul 19 '05 #1
3 17404
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="submitButton_OnClick">
<!-- notice: type="button" NOT type="submit" -->
</form>

<script language="javascript" type="text/javascript">
function submitButton_OnClick(){
// 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="VBSCRIPT" CODEPAGE="1252"%>
<%
dim bSave

bSave=Request.QueryString("save")
if bSave="1" then
'process
end if
%>
...
function init(bSave){
if(bSave=='1'){
window.returnValue=bSave;
window.close();
}
}
...
<body onLoad="init('<% Response.Write(bSave)%>');">
....
<form id="b" name="b" action="?save=1" method="post"
target="_self">
...

Any idea ?

Jul 19 '05 #2
Put an iframe in the modal dialog and host the form in that.

tim
"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="VBSCRIPT" CODEPAGE="1252"%>
<%
dim bSave

bSave=Request.QueryString("save")
if bSave="1" then
'process
end if
%>
...
function init(bSave){
if(bSave=='1'){
window.returnValue=bSave;
window.close();
}
}
...
<body onLoad="init('<% Response.Write(bSave)%>');">
....
<form id="b" name="b" action="?save=1" method="post"
target="_self">
...

Any idea ?

Jul 19 '05 #3
I knew it ! What I've done is that I created an xml tag
inside of my dialog and a function to fill it with my
form's fields and I return the xml string to the caller.

Works fine like this.

Thank You very much.

-----Original Message-----
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 ascript that concantenates all the values together from the form when the"submit" button is clicked, assigns that value to a variable and returns itbefore closing the window. The hardest part is coordinating what's sentback 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="submitButton_OnClick"> <!-- notice: type="button" NOT type="submit" -->
</form>

<script language="javascript" type="text/javascript">
function submitButton_OnClick(){
// 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="VBSCRIPT" CODEPAGE="1252"%>
<%
dim bSave

bSave=Request.QueryString("save")
if bSave="1" then
'process
end if
%>
...
function init(bSave){
if(bSave=='1'){
window.returnValue=bSave;
window.close();
}
}
...
<body onLoad="init('<% Response.Write(bSave)%>');">
....
<form id="b" name="b" action="?save=1" method="post"
target="_self">
...

Any idea ?

.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olan Wilson | last post by:
I have a pretty standard ASP page I want to display in a modal dialog box. The first part of the script is a couple input boxes and a submit button inside of a form with its action property set to...
0
by: Jinx | last post by:
Windows IE ..NET PROBLEM: After invoking showModalDialog(), a form comes up, the user clicks submit, and a NEW webpage opens. SOLUTION After reading numerous posts that say, paraphrased,...
6
by: Scott Lee | last post by:
I am displaying an ASP.Net generated form in a popup opened with window.showModalDialog. The form contains DropDownList controls. The first ddl is populated via databinding to a datatable, has...
3
by: Paul K | last post by:
I'm not quite sure if the problem I'm having is a restriction of showModalDialog or if there is a way around it. The web app I am working requires the user to select a record from a list. I pop...
5
by: Tmajarov | last post by:
Haven't been able to find a clear answer to this... I am building an asp.net application and trying to enforce some work flow by displaying a form via the showmodaldialog method. I can get the...
2
by: Sarah | last post by:
I am using the javascript showModalDialog function to open a file upload window. The function opens a page which contains a usercontrol housing the file upload stuff. The control works fine when...
1
by: dan_williams | last post by:
I'm trying to create a textbox control on an asp.net web page, that after a user has typed some text into it, another pop-up window appears with a dropdownlist populated with options related to the...
4
by: Ralf | last post by:
Here is my scenerio and what I am doing. I am open to other ways of doing this is it makes sense. I have a cell withing a row within a datagrid. When this cell is clicked (its a date field), I...
0
by: charithstudy | last post by:
Hi All, In ASP.NET , I am using window.showModalDialog method to open a modal window. But when I try to do some processing in the modal window, it opens up another window. Like i have to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.