Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > how to make a window modal in nature

Reply
Thread Tools

how to make a window modal in nature

 
 
amith
Guest
Posts: n/a
 
      12-04-2003
Hi,

I have a javascript, calendar.js which i use to enable my client to
select the date. This calendar pops up on the click of a gif image.
But the problem is that this poped up window is not modal in nature(i
do not want the user to go the parent page unless he selects some date
in the calendar popup).

In the javascript calendar.js he has used window.open() function to
pop up the window. i just want to know whether we have any attribute
which when set to yes will make the window behave modal in
nature.(just like resizable="yes",toolbar="yes", do we have
modal="yes" ?)

i checked modal="yes" and it does not make the window behave modal in
nature. Am i using the wrong attribute name?(modal="yes").

Do we have such attribute. If not what are my other options.

I know that we can use window.showModalDialog(), but i need to modify
the window.open() function to make the window behave modally. Is it
possible to do so?

regards
Amith
 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      12-04-2003
"amith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
<snip>
>This calendar pops up on the click of a gif image.


Sometimes.

>But the problem is that this poped up window is not modal
>in nature(i do not want the user to go the parent page
>unless he selects some date in the calendar popup).


Even if the window was modal (including showModalDialog windows) it
would (and should) still be possible for the user to close it and return
to the parent without making a selection.

>In the javascript calendar.js he has used window.open()
>function to pop up the window. i just want to know whether
>we have any attribute which when set to yes will make the
>window behave modal in nature.(just like resizable="yes",
>toolbar="yes", do we have modal="yes" ?)


No, the new browser instance that is one of the possible results of a
call to the window.open function is a separate process and is not modal
in nature and there are no window features list options that will make
it so. "dependent" (where implemented) comes closest with some browsers
but is so inconsistently implemented that it is probably best just to
leave that alone.

>i checked modal="yes" and it does not make the window behave
>modal in nature. Am i using the wrong attribute name?(modal="yes").


You can make up as may feature keys as you like, if they don't appear in
the documentation they are unlikely to do anything but harm.

>Do we have such attribute.


No.

>If not what are my other options.


1.Attempt to script the new window into a (pseudo) modal window by
monitoring the blur and focus events on all elements in each window so
that re-focusing the original window (or any of its contents) results in
the focus being passed back to the new window. This may sound like a
simple option but in reality is quite tricky to do well and has been
done badly in the past with sufficient frequency that recent browsers
are including user options to prevent scripts from actively focusing
window, so ultimately it can no longer be done reliably anyway. (not
that opening pop-up window can be done reliably anyway).

2.Re-design the process until the perceived need for the window to be
modal goes away (so it will not matter that it cannot reliably be made
so).

3.Navigate the current window to the calendar page, thus making
simultaneous interaction with the first page impossible.

4.Use an "in window pop-up" (DHTML) for the calendar instead of the new
window.

>I know that we can use window.showModalDialog(),


It is an IE only feature so it would be inappropriate to use it on the
internet, at least without writing such a lot of fall-back code for
non-IE browsers that it would be easier to just use the
non-showModalDialog code for all browsers.

>but i need to modify the window.open() function to
>make the window behave modally. Is it possible to
>do so?


If you put enough effort into the blur/focus script and think through,
and test, all of the possibilities then maybe. I would go with the "in
window pop-up" for that type of UI component if I wanted the modal
dialog effect, and navigating the current window if I wanted absolute
reliability.

Richard.


 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Modal and non modal in same app Leila Java 0 04-26-2005 09:48 PM
How to close a parent modal window when child modal window opens? gopal srinivasan Javascript 0 11-05-2004 05:59 AM
post the form data in modal window and close the modal window. Matt HTML 1 06-01-2004 08:22 PM
post the form data in modal window and close the modal window. Matt Javascript 0 06-01-2004 07:47 PM



Advertisments