Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > showModalDialog and submit

Reply
Thread Tools

showModalDialog and submit

 
 
Joel
Guest
Posts: n/a
 
      11-25-2003
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 ?
 
Reply With Quote
 
 
 
 
William Morris
Guest
Posts: n/a
 
      11-25-2003
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" <(E-Mail Removed)> wrote in message
news:083701c3b362$bc164990$(E-Mail Removed)...
> 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 ?



 
Reply With Quote
 
 
 
 
Tim Williams
Guest
Posts: n/a
 
      11-26-2003
Put an iframe in the modal dialog and host the form in that.

tim


"Joel" <(E-Mail Removed)> wrote in message
news:083701c3b362$bc164990$(E-Mail Removed)...
> 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 ?



 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      11-26-2003
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 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" <(E-Mail Removed)> wrote in message
>news:083701c3b362$bc164990$(E-Mail Removed)...
>> 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 ?

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Catching Submit Event even called by document.forms[0].submit() The Crow ASP .Net 2 09-27-2005 05:03 PM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM
Open showModalDialog from showModalDialog Jonathan Javascript 0 07-19-2004 02:30 PM
Disable Submit Button until Accept Terms and Redirect Page on Submit Paul Oakfleet Javascript 1 09-10-2003 06:07 PM



Advertisments