473,802 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnBlur firing when not expected.

Hello all...
I am working on an ASP.NET 2.0 application with VS2005 and VB. I have chosen
to use popup windows in some cases because it makes the user experience
better (according to all the users I have polled who will be using this
app).

In an attempt to keep the popup from disappearing behind the calling window,
I am adding the onblur="FocusMe ():" event to the Body tag of the popup. I
really want onblur to react to any click outside the popup Window, but I
have read that the only place to put that event when trying to apply it to
the window is in the Body tag. BTW... FocusMe() just does window.focus();

Well I thought this would be a simple task and work just fine... after all,
doesn't everybody who uses popups have to deal with this issue? That's why I
also expected to find copious documentation on the subject if I ran into a
problem...not so.

Apparently when I click on any form input type control (text, select, etc.)
that is clearly within the Window and within the Body tags, the
window.onblur (body.onblur) event fires, and the input control does not
function. Not what I expected.

I then tried placing an OnClick event in the Body of the parent window...
which looks for an open popup and places focus back onto it. That allows
controls inside the popup to work, but fails if I click on certain controls
(like links) in the parent window.

I have looked in Javascript forums and books for answers and have not found
them yet. So I am posting here, since my development environment is ASP.NET
2.0.

Somebody please tell me there is an easy way to fix this problem, and I have
just not found it yet.

Thanks to all for your help.
May 2 '07 #1
10 2463
Not sure what is the problem you are trying to solve. Are you trying to
create an "always on top" window or a modal dialog ? Could it be acceptable
to create a div with the appropriate z-index order ?
"John Kotuby" <jo***@powerlis t.coma écrit dans le message de news:
Oe************* *@TK2MSFTNGP02. phx.gbl...
Hello all...
I am working on an ASP.NET 2.0 application with VS2005 and VB. I have
chosen to use popup windows in some cases because it makes the user
experience better (according to all the users I have polled who will be
using this app).

In an attempt to keep the popup from disappearing behind the calling
window, I am adding the onblur="FocusMe ():" event to the Body tag of the
popup. I really want onblur to react to any click outside the popup
Window, but I have read that the only place to put that event when trying
to apply it to the window is in the Body tag. BTW... FocusMe() just does
window.focus();

Well I thought this would be a simple task and work just fine... after
all, doesn't everybody who uses popups have to deal with this issue?
That's why I also expected to find copious documentation on the subject if
I ran into a problem...not so.

Apparently when I click on any form input type control (text, select,
etc.) that is clearly within the Window and within the Body tags, the
window.onblur (body.onblur) event fires, and the input control does not
function. Not what I expected.

I then tried placing an OnClick event in the Body of the parent window...
which looks for an open popup and places focus back onto it. That allows
controls inside the popup to work, but fails if I click on certain
controls (like links) in the parent window.

I have looked in Javascript forums and books for answers and have not
found them yet. So I am posting here, since my development environment is
ASP.NET 2.0.

Somebody please tell me there is an easy way to fix this problem, and I
have just not found it yet.

Thanks to all for your help.

May 2 '07 #2
"John Kotuby" <jo***@powerlis t.comwrote in message
news:Oe******** ******@TK2MSFTN GP02.phx.gbl...
Somebody please tell me there is an easy way to fix this problem, and I
have just not found it yet.
Is this a public Internet app or a closed intranet app...?
--
http://www.markrae.net

May 2 '07 #3
Thanks for the quick responses. I was busy looking into
window.showModa lDialog function for the last couple hours and am having
trouble getting it to work in IE7.

It is a public internet application that requires authentication. The aspx
form displayed in the window must be filled out and submitted (posted back)
to allow creation of a Record entry (using the entered form values) in SQL
Server.

In essence I want the user to fill out the form before continuing back to
the parent window. I could just navigate to another aspx, and let the user
go back to the "parent" window to continue working. However, it is simpler
for the user to do repetitive tasks from the "parent" window if I just use a
"modal" popup.

BTW...This part of the application is available after the user logs in and
is authenticated. It is not part of the login.

"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:ek******** ******@TK2MSFTN GP06.phx.gbl...
"John Kotuby" <jo***@powerlis t.comwrote in message
news:Oe******** ******@TK2MSFTN GP02.phx.gbl...
>Somebody please tell me there is an easy way to fix this problem, and I
have just not found it yet.

Is this a public Internet app or a closed intranet app...?
--
http://www.markrae.net

May 2 '07 #4
I am trying to create a modal window in which the user fills out form
information, submits it, the window closes, and the user is back to the
parent window and can then repeat a similar task with any of possibly
hundreds of Repeater entries that might be present on that page.

I have to think about whether "always on top" would actually work better. I
have been reading about the window.ShowModa lDialog function and that it has
trouble with posting back to the server. I have also been getting synatax
errors trying to create it.
------------------------------------------
function OpenNewWin(type )
{
if(type=='deck' )
{ if(window.showM odalDialog)
{
window.showModa lDialog("/Search/NewDeck.aspx", window, "dialogHeig ht: 500px;
dialogWidth: 550px; dialogTop: 40px; dialogLeft: 40px; edge: Raised; center:
Yes; help: No; resizable: Yes; status: Yes;");
}
else
{
var
newdeck=window. open("/Search/NewDeck.aspx"," newdeck","modal =yes,title=show ,toolbar=0,loca tion=0,status=0 ,menubar=0,scro llbars=1,resiza ble=1,width=550 ,height=500,top =40,left=40");
popWin=newdeck; newdeck.focus() ;
}
}

if(type=='card' ) ........... and so on.
-------------------------------
I am getting the syntax error on the line beginning
window.showModa lDialog("/Search/NewDeck.aspx", window, "dialogHeig ht:
500px ........

"Patrice" <http://www.chez.com/scribe/wrote in message
news:eY******** ******@TK2MSFTN GP06.phx.gbl...
Not sure what is the problem you are trying to solve. Are you trying to
create an "always on top" window or a modal dialog ? Could it be
acceptable to create a div with the appropriate z-index order ?
"John Kotuby" <jo***@powerlis t.coma écrit dans le message de news:
Oe************* *@TK2MSFTNGP02. phx.gbl...
>Hello all...
I am working on an ASP.NET 2.0 application with VS2005 and VB. I have
chosen to use popup windows in some cases because it makes the user
experience better (according to all the users I have polled who will be
using this app).

In an attempt to keep the popup from disappearing behind the calling
window, I am adding the onblur="FocusMe ():" event to the Body tag of the
popup. I really want onblur to react to any click outside the popup
Window, but I have read that the only place to put that event when trying
to apply it to the window is in the Body tag. BTW... FocusMe() just does
window.focus() ;

Well I thought this would be a simple task and work just fine... after
all, doesn't everybody who uses popups have to deal with this issue?
That's why I also expected to find copious documentation on the subject
if I ran into a problem...not so.

Apparently when I click on any form input type control (text, select,
etc.) that is clearly within the Window and within the Body tags, the
window.onblu r (body.onblur) event fires, and the input control does not
function. Not what I expected.

I then tried placing an OnClick event in the Body of the parent window...
which looks for an open popup and places focus back onto it. That allows
controls inside the popup to work, but fails if I click on certain
controls (like links) in the parent window.

I have looked in Javascript forums and books for answers and have not
found them yet. So I am posting here, since my development environment is
ASP.NET 2.0.

Somebody please tell me there is an easy way to fix this problem, and I
have just not found it yet.

Thanks to all for your help.


May 2 '07 #5
"John Kotuby" <jo***@powerlis t.comwrote in message
news:u8******** ******@TK2MSFTN GP02.phx.gbl...
Thanks for the quick responses. I was busy looking into
window.showModa lDialog function for the last couple hours and am having
trouble getting it to work in IE7.
Really? Works perfectly in IE7 for me... What specific problems are you
having...?
It is a public internet application
Ah - well that rules showModalDialog out, then, as that is supported only in
IE and the latest version of Safari...

May 2 '07 #6
Hi Mark,

I was having truoble getting the showModalDialog to run because I was
leaving the "argument" argument empty instead of passing something like
"window" which I am doing in the below example. Now it works fine.

Since it is actually a paid subscription site that is used for research
during business hours, we can stipulate IE if we want.
However, I saw a great article that showed me how to test for
showModalDialog in javascript...

{ if(window.showM odalDialog)
{
window.showModa lDialog("/Search/NewDeck.aspx", window, "dialogHeig ht: 500px;
");
}
else
{
var
newdeck=window. open("/Search/NewDeck.aspx"," newdeck","modal =yes,title=show ");
}

The modal=yes attribute works for newer Mozilla/Foxfire browsers. No excuse
not to use a newer browser for security...espe cially in business.

"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:O0******** ******@TK2MSFTN GP05.phx.gbl...
"John Kotuby" <jo***@powerlis t.comwrote in message
news:u8******** ******@TK2MSFTN GP02.phx.gbl...
>Thanks for the quick responses. I was busy looking into
window.showMod alDialog function for the last couple hours and am having
trouble getting it to work in IE7.

Really? Works perfectly in IE7 for me... What specific problems are you
having...?
>It is a public internet application

Ah - well that rules showModalDialog out, then, as that is supported only
in IE and the latest version of Safari...

May 2 '07 #7
"John Kotuby" <jo***@powerlis t.comwrote in message
news:OA******** ******@TK2MSFTN GP04.phx.gbl...
The modal=yes attribute works for newer Mozilla/Foxfire browsers.
Obviously you mean FireFox...

The modal=yes tab is completely unreliable. I have just tried it on a
variety of browser / platform combinations, and the only one it worked on
was Mozilla 1.7.13 for Windows.

It failed on all of the following:

FireFox 2.0.0.3 for Windows, Mac & Linux
Opera 9.20 for Windows, Mac & Linux
Netscape 8.1.2 for Windows
Netscape 7.2 for Mac & Linux
Mozilla 1.7.13 for Mac & Linux
Camino 1.0.4 for Mac
SeaMonkey 1.1.1 for Windows, Mac & Linux

May 2 '07 #8
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:OA******** ********@TK2MSF TNGP02.phx.gbl. ..
It failed on all of the following:
I forgot to mention that it also failed on:

Epiphany 2.18.1 for Linux
Konqueror 3.5.6 for Linux
--
http://www.markrae.net

May 2 '07 #9
Mark,
You are indeed correct..
My error entirely. "Always test before you speak " is what I should
remember. Along with "Don't believe everything you read".

I don't want to be passing along bad informattion and I'm glad you called me
on it.

I have since seen other postings where for FireFox it is recommended to
feign pop-ups with absolute positioned <divelements (or other appropriate
elements), change either visibility attributes(whic h I have done in IE) or
z-order (something I havent even messed with yet).

The coders that code primarily for FireFox bad mouth IE for it's stupididy
in failing to understand simple css commands, while I say "why doesn't
firefox respect the modal attribute" .

I guess its all a point of view thing.

Even in IE I have found that PostBacks with modal or even modeless dialogs
present some problems. When just opening a child window without modality,
the postbacks appear in the same child window... which is what I want.

I am back to looking at the onblur event and how to tell when the mouse
pointer is outside of the child window or just pointing to a form element
within the child window. If that is easy to determine then I can use the
onblur event and just do nothing if the mousepointer is still in the child
window or call self.focus() top.focus() or window.focus() if it's not.
Another option is to (maybe) somehow disable the entire parent window when
creating the popup.

My other alternative is to feign a popup by creating a div or table inside
the original form and displaying it when necessary... but that would require
a LOT of new coding at this point, when the boss is screaming for results.

I can't believe such a simple thing can present such problems.. for me at
least. For now I must move on with other aspects of the application until I
find the right solution for the popups.

Thanks for your help...

"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:OA******** ********@TK2MSF TNGP02.phx.gbl. ..
"John Kotuby" <jo***@powerlis t.comwrote in message
news:OA******** ******@TK2MSFTN GP04.phx.gbl...
>The modal=yes attribute works for newer Mozilla/Foxfire browsers.

Obviously you mean FireFox...

The modal=yes tab is completely unreliable. I have just tried it on a
variety of browser / platform combinations, and the only one it worked on
was Mozilla 1.7.13 for Windows.

It failed on all of the following:

FireFox 2.0.0.3 for Windows, Mac & Linux
Opera 9.20 for Windows, Mac & Linux
Netscape 8.1.2 for Windows
Netscape 7.2 for Mac & Linux
Mozilla 1.7.13 for Mac & Linux
Camino 1.0.4 for Mac
SeaMonkey 1.1.1 for Windows, Mac & Linux

May 3 '07 #10

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

Similar topics

2
2441
by: Eric | last post by:
Hello, I'm having trouble with a bit of code that is both validating and updating fields on the fly. Here's something similar to my code: ----------- <script> function validate(field) { var frm = document.theForm; if (field.value != "") {
9
3714
by: Roger Withnell | last post by:
Tearing hair out time! Simple attached page shows the problem. http://www.brilley.co.uk/TestFocusSelect.htm Using a function to test if too many characters have been keyed in to a textarea. Obviously, must return focus and select to the textarea if too many have been keyed. When the function is called with onblur, it works in IE but not in Safari or NN. The function is called but the focus() and select() methods fail.
6
7330
by: rob | last post by:
Hi I'm trying to create a "roll-up" effect when a window loses focus and then "roll-down" when it regains focus. This statement works properly with every browser I can get my hands on EXCEPT WinIE6. WinIE6 says there's an error in the code, but the debugging info says the problem is on line 1 char 1, which are comments. <Body bgcolor='black' Text='#dbdbdb' onblur='window.resizeTo(150,150)'
2
5697
by: Heiko Vainsalu | last post by:
Hi Hope somebody knows how to solve this one. *The Situation* A traditional situation where HTML form inputs are checked... (if simplified then it would look something like this) <form onSubmit="return checkWholeForm(this)">
1
5680
by: neil S via DotNetMonster.com | last post by:
I have a custom control with a textbox and dropdown list. The dropdown list is hidden and acts as a data source for the textbox. When the user enters text in the textbox, an onKeyup event is fired and retrieves the first value from the dropdown list equal to that entered, and fills the text box. Essentially, the two together are acting as a type ahead/autocomplete thingy. All this works fine. Here's my problem: I wanted to expose the...
4
11881
by: josh.dutcher | last post by:
I'm trying to set up a simple "change your password" form. I've got an AJAX process that is checking the new password the user enters against their current password to make sure they're changing it. This function is firing via the password field's onBlur event handler. I want to do some other form validation using the form's onSubmit handler (onSubmit="return validateForm();", and if all those conditions are met, the form submits. ...
5
3096
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any ideas?
1
2611
by: Duncan | last post by:
Hi all, I'm tearing my hair out on this! I have a simple ASP.NET 2 page with a TextBox control, in the PreRender I set ClientSide events:- Response.Attributes.Add("onchange", "javascript:alert('Changed');"); Response.Attributes.Add("onfocus",
2
2765
by: John Kotuby | last post by:
Hi all, I am integrating some 3rd party grids into a large ASPX form page in VS 2008 using VB. I have 4 different grids on the page. The object is to not allow the user to leave a grid if he/she is in the middle of editing a row and has not selected the button to "save" the changes to the client-mode grid. BTW, none of these "changes" are actually saved to the database until the entire page is posted back (I am not using Callbacks on...
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10063
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9115
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.