473,402 Members | 2,053 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,402 software developers and data experts.

Modal Dialog

I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to see
if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom
Nov 19 '05 #1
8 2867
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@TK2MSFTNGP14.phx.gbl...
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to
see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom

Nov 19 '05 #2
TJS
not quite modal because you can close the dialog without making a choice
"Robbe Morris [C# MVP]" <in**@turnkeytools.com> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@TK2MSFTNGP14.phx.gbl...
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to
see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom


Nov 19 '05 #3
"Robbe Morris [C# MVP]" <in**@turnkeytools.com> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp
That looks like exactly what I was looking for. I haven't tried it in my
..net pages yet, but I don't see why it wouldn't work. BTW, is there a way
to make the links actual buttons? If not, that's fine.

Thanks,

Tom
--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@TK2MSFTNGP14.phx.gbl...
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to
see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom


Nov 19 '05 #4
"TJS" <no****@here.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
not quite modal because you can close the dialog without making a choice
I am definately not going to quibble, here. This is exactly what I need.

Is there a way to tell if the window was closed using the "x" or is there a
way to turn the "x" off?

Also, is the line:

ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",5) ;

the one that makes it modal. I assume this is just resetting focus every 5
ms. Is there some reason for using 5 verses 10, 20 or 30 etc?

Thanks,

Tom

"Robbe Morris [C# MVP]" <in**@turnkeytools.com> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@TK2MSFTNGP14.phx.gbl...
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section
of the modal window to make it work. I tried putting it both pages just
to see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom



Nov 19 '05 #5
I wanted to pass in the asp.net object where I want the result to go and
wanted to do something like:

function YesNoCancelReturnMethod(returnVar)
{
document.getElementById(returnVar).value = ModalDialog.value;
ModalDialogRemoveWatch();
}

but I can't figure out how the javascript call would go:

<a href="javascript:YesNoCancel('Yes, no, or cancel
me','YesNoCancelReturnMethod(modalreturn1)');">Sho w Modal #1</a>

This doesn't work (which I didn't expect it would). But I can't figure out
how to get the variable name to the event.

Tom

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eX**************@TK2MSFTNGP14.phx.gbl...
"TJS" <no****@here.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
not quite modal because you can close the dialog without making a choice


I am definately not going to quibble, here. This is exactly what I need.

Is there a way to tell if the window was closed using the "x" or is there
a way to turn the "x" off?

Also, is the line:

ModalDialogInterval =
window.setInterval("ModalDialogMaintainFocus()",5) ;

the one that makes it modal. I assume this is just resetting focus every
5 ms. Is there some reason for using 5 verses 10, 20 or 30 etc?

Thanks,

Tom


"Robbe Morris [C# MVP]" <in**@turnkeytools.com> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@TK2MSFTNGP14.phx.gbl...
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section
of the modal window to make it work. I tried putting it both pages
just to see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom



Nov 19 '05 #6
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eX**************@TK2MSFTNGP14.phx.gbl...
Is there a way to tell if the window was closed using the "x"


If you look at the demo, when you click one of the links it returns "Yes",
"No" etc into the textbox. When you click the x in the top-right corner, it
returns an empty string into the textbox.
Nov 19 '05 #7
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:eV**************@TK2MSFTNGP15.phx.gbl...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eX**************@TK2MSFTNGP14.phx.gbl...
Is there a way to tell if the window was closed using the "x"
If you look at the demo, when you click one of the links it returns "Yes",
"No" etc into the textbox. When you click the x in the top-right corner,

it returns an empty string into the textbox.


So, I assume the best way to make it work would be to put something in the
textbox and then check if it is empty. If it is, the user pressed the "x"
to close the window.

I am having a problem with using this in an asp.net page using buttons.

I made a change where I pass the title and the name of the textbox to the
function, but otherwise it is the same. Here is the page I am using at the
moment:

************************************************** **************************
*
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup="true"
ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<!--#include virtual = '/Development/includes/ModalDialogs.inc'-->
<script runat="server">
sub page_load(s as object, e as eventArgs)
if not isPostBack then
Button1.Attributes.Add("onclick", "YesNoCancel('This is a
test','modalreturn2','Yes, no, or cancel me','YesNoCancelReturnMethod()');")
end if
end sub
</script>
<form runat="server">
<asp:Button ID="Button1" text="submit" runat="server"/><br>
<input type=text id=modalreturn2 name=modalreturn2 value=''><br>
<a href="javascript:YesNoCancel('This is the first
Title','modalreturn2','Yes, no, or cancel
me','YesNoCancelReturnMethod()');">Show Modal #1</a>
</form>
<p>&nbsp;</p>
</body>
</html>
************************************************** ************

In this page am calling the javascript popup from a link and a button. With
the link it works everytime I press the link. Once I use the button, it
doesn't work for the link anymore.

For the button, it opens the popup fine, but it never returns when I press
the link on the popup page. It only returns when I press the "x". It never
returns anything from the popup (not even the empty string when pressing the
"x").

At this point, neither the button nor the link will bring up the popup box.

What is the problem here?

Here is the page that is rendered from .aspx:

************************************************** ************************
<script language=JavaScript>

var ModalDialogWindow;
var ModalDialogInterval;
var ModalDialog = new Object;

ModalDialog.value = '';
ModalDialog.eventhandler = '';
ModalDialog.returnAddress = '';
function ModalDialogMaintainFocus()
{
try
{
if (ModalDialogWindow.closed)
{
window.clearInterval(ModalDialogInterval);
eval(ModalDialog.eventhandler);
return;
}
ModalDialogWindow.focus();
}
catch (everything) { }
}

function ModalDialogRemoveWatch()
{
ModalDialog.value = '';
ModalDialog.eventhandler = '';
}

function ModalDialogShow(Title,ReturnAddress,BodyText,Butto ns,EventHandler)
{
alert("this is a test");
ModalDialogRemoveWatch();
ModalDialog.eventhandler = EventHandler;
ModalDialog.returnAddress = ReturnAddress;

var args='width=350,height=125,left=325,top=300,toolba r=0,';
args+='location=0,status=0,menubar=0,scrollbars=1, resizable=0';

ModalDialogWindow=window.open("","",args);
ModalDialogWindow.document.open();
ModalDialogWindow.document.write('<html>');
ModalDialogWindow.document.write('<head>');
ModalDialogWindow.document.write('<style>body{back ground-color:
#B2CBD2;}</style>')
ModalDialogWindow.document.write('<title>' + Title + '</title>');
ModalDialogWindow.document.write('<script' + ' language=JavaScript>');
ModalDialogWindow.document.write('function CloseForm(Response) ');
ModalDialogWindow.document.write('{ ');
ModalDialogWindow.document.write(' window.opener.ModalDialog.value =
Response; ');
ModalDialogWindow.document.write(' window.close(); ');
ModalDialogWindow.document.write('} ');
ModalDialogWindow.document.write('</script' + '>');
ModalDialogWindow.document.write('</head>');
ModalDialogWindow.document.write('<body onblur="window.focus();">');
ModalDialogWindow.document.write('<table border=0 width="95%"
align=center cellspacing=0 cellpadding=2>');
ModalDialogWindow.document.write('<tr><td align=left>' + BodyText +
'</td></tr>');
ModalDialogWindow.document.write('<tr><td align=left><br></td></tr>');
ModalDialogWindow.document.write('<tr><td align=center>' + Buttons +
'</td></tr>');
ModalDialogWindow.document.write('</body>');
ModalDialogWindow.document.write('</html>');
ModalDialogWindow.document.close();
ModalDialogWindow.focus();
ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",5) ;

}

</script>

<script language=JavaScript>
function YesNoCancel(Title,returnAddress,BodyText,EventHand ler)
{
var Buttons='';
Buttons = '<a href=javascript:CloseForm("Yes");>Yes</a> ';
Buttons += '<a href=javascript:CloseForm("No");>No</a> ';
Buttons += '<a href=javascript:CloseForm("Cancel");>Cancel</a> ';
ModalDialogShow(Title,returnAddress,BodyText,Butto ns,EventHandler);
}

function YesNoMaybe(Title,returnAddress,BodyText,EventHandl er)
{
var Buttons='';
Buttons = '<a
href=javascript:CloseForm("Yes");>Yes</a>&nbsp;&nbsp;&nbsp;&nbsp; ';
Buttons += '<a
href=javascript:CloseForm("No");>No</a>&nbsp;&nbsp;&nbsp;&nbsp; ';
Buttons += '<a href=javascript:CloseForm("Maybe");>Maybe</a> ';
ModalDialogShow(Title,ReturnAddress,BodyText,Butto ns,EventHandler);
}

function YesNoCancelReturnMethod()
{
document.getElementById(ModalDialog.returnAddress) .value =
ModalDialog.value;
ModalDialogRemoveWatch();
}

function YesNoMaybeReturnMethod()
{
document.getElementById(ModalDialog.returnAddress) .value =
ModalDialog.value;
ModalDialogRemoveWatch();
}

</script>

<form name="_ctl0" method="post" action="TMP28cypdoa6c.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="dDw5NjU1MTU1O3Q8O2w8aTwxPjs+O2w8dDw7bDxpPDE +Oz47bDx0PHA8O3A8bDxvbmNsa
WNrOz47bDxZZXNOb0NhbmNlbCgnVGhpcyBpcyBhIHRlc3QnLCd tb2RhbHJldHVybjInLCdZZXMsI
G5vLCBvciBjYW5jZWwgbWUnLCdZZXNOb0NhbmNlbFJldHVybk1 ldGhvZCgpJylcOzs+Pj47Oz47P
j47Pj47Pgp4F76kb7VjTMvhPLbWVoJO6PFw" />

<input type="submit" name="Button1" value="submit" id="Button1"
onclick="YesNoCancel('This is a test','modalreturn2','Yes, no, or cancel
me','YesNoCancelReturnMethod()');" /><br>
<input type=text id=modalreturn2 name=modalreturn2 value=''><br>
<a href="javascript:YesNoCancel('This is the first
Title','modalreturn2','Yes, no, or cancel
me','YesNoCancelReturnMethod()');">Show Modal #1</a>
<input type=hidden name='_sk_scrollkeepervalue' id='_sk_scrollkeepervalue'
value='0!0'><script>function SKFilter_SetPosition(){
scrollTo(0,0);}</script><script language='javascript'>onscroll =
function(){document.getElementById('_sk_scrollkeep ervalue').value =
document.body.scrollLeft+'!' + document.body.scrollTop;}</script></form>
<p>&nbsp;</p>

</body>
</html>
************************************************** ************************

Thanks,

Tom
Nov 19 '05 #8
"tshad" <tf*@dslextreme.com> wrote in message
news:u5**************@tk2msftngp13.phx.gbl...
If you look at the demo, when you click one of the links it returns
"Yes",
"No" etc into the textbox. When you click the x in the top-right corner,

it
returns an empty string into the textbox.


So, I assume the best way to make it work would be to put something in the
textbox and then check if it is empty. If it is, the user pressed the "x"
to close the window.


I guess so - or a JavaScript variable...
Nov 19 '05 #9

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

Similar topics

2
by: Gilles T. | last post by:
Hi, How I can refresh a modal dialog in asp.net? I open a modal dialog in first with a dropdownlist. To add a element in my dropdownlist (table), I open a second modal dialog to ask element and...
2
by: Gilles T. | last post by:
Hi, How I can refresh a modal dialog in asp.net? I open a modal dialog in first with a dropdownlist. To add a element in my dropdownlist (table), I open a second modal dialog to ask element and...
10
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a...
0
by: javaguy | last post by:
I'm working with code from the book "Ajax in Action" (by Dave Crane, Manning Press). The chapter 6 code has a "notifier" object. It will show a dialog box with messages in it by attaching a...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.