showModalDialog

O

Olan Wilson

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 the same ASP page and a
method of post. The second part is the form handler that inserts the data
entered by the user into a database table. The initial HTML form displays
just fine in the modal dialog box, but when the user clicks the submit
button a new window is opened that the ASP code executes in and then closes
with a window.close command. I would like for the form processing to occur
in the same modal dialog box and then have that same dialog either close or
display the error as appropiate. Any ideas?

My guess is that I need to specify a target for the form, but I can't figure
out what target to use.

From memory the code is something like:

AddNew.asp:
select case request.querystring("action")
case "addnew"
<form name=AddNew method=post action="AddNew.asp?action=save">
<input type=text name=txtHostName>
<input type=text name=txtDesc>
<input type=submit name=subAdd value=Add>
</form>
case "save"
'insert the data in the database
if err.number = 0 then
response.write ("<script
language=""vbscript"">window.close</script>")
else
response.write ("error stuff")
end if
end select

This page is called from another page like so:

QueryLists.asp:
'populate the page from the database
..
..
..

<input type=button name=btnAdd value="Add New">
..
..
..
<script language="vbscript">
function btnAdd_OnClick
window.showmodaldialog "AddNew.asp?action=addnew"
document.location.reload ("QueryLists.asp")
end function
</script>
 
R

Ray Costanzo [MVP]

This isn't anything that ASP can control. It is a client-side issue, and an
IE-only one at that.

But, for the record, the behavior you're seeing is by design of the modal IE
window. Even if you have a link in that modal dialog, that would also open
in a new window. What you ~can~ do is create an outer page, outer.htm, and
iframe querylists.asp into it in the modal dialog.

Ray at work
 
O

Olan Wilson

That works great. Thanks for your help Ray.

Ray Costanzo said:
This isn't anything that ASP can control. It is a client-side issue, and
an IE-only one at that.

But, for the record, the behavior you're seeing is by design of the modal
IE window. Even if you have a link in that modal dialog, that would also
open in a new window. What you ~can~ do is create an outer page,
outer.htm, and iframe querylists.asp into it in the modal dialog.

Ray at work
 

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,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top