Welcome Guest Search | Active Topics | Members | Log In | Register

Vista, IE7, and cancelling an onclick event Options · View
bruce barker
Posted: Thursday, October 04, 2007 8:04:46 AM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 04/10/2007 08:04:46
Date: Thu, 04 Oct 2007 15:04:46 -0700

IE has a long standing bug where this happens (back to 5.5). Never sure
what triggers it, you will find it works on another box with the same
software.

anyway the fix is easy, but causes trouble if you need event bubbling
(not in your case). add the following function to your page:

function cancelEvent()
{
// ie only hack
if (window.event) window.event.cancelBubble = true;
// everyone else
return false;
}

then change your onclick to:

<input type="submit"
onclick="if(!confirm('blah...'))return cancelEvent();"
value="Click here for page 2">



-- bruce (sqlwork.com)


Chris Walls wrote:
> If there is a better newsgroup for this, please let me know. I also cannot
> seem to get to the MSDN forums; the page never loads...
>
> We have an ASP.NET 2.0 application that uses the AJAX Extensions and the
> AJAX Control Toolkit. Many of our pages use JavaScript confirm dialogs for
> standard "Are you sure" messages. One of our users is running IE 7 on Vista
> Business. The following code displays the confirm correctly, but the cancel
> response is essentially ignored and the user is taken to page2.html. This
> exact same code works on Vista Home Premium w/IE 7 and WinXP w/IE, Firefox,
> Opera, and Safari. It also works on the Vista Business machine with
> Firefox, so we are fairly certain this is an IE 7 / Vista Business issue.
>
> Any thoughts on what it could be? We perused the options available for IE
> and none drew our attention as being a possible culprit. The other
> JavaScript code in the application has been executing as expected.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head>
> <title>Page 1</title>
> </head>
> <body>
> <form action="Page2.htm" method="post">
> <h1>You are now on page 1</h1>
> <input type="submit" onclick="return confirm('Are you sure you want to go
> to page 2?');" value="Click here for page 2">
> </form>
> </body>
> </html>
>
>
>
> ************* Page2.htm ****************
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head>
> <title>Untitled Page</title>
> </head>
> <body>
> <h1>You are now on page 2</h1>
> <a href="Page1.htm">Back To Page 1</a>
> </body>
> </html>
>
>
Chris Walls
Posted: Thursday, October 04, 2007 9:33:26 AM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 04/10/2007 09:33:26
Date: Thu, 4 Oct 2007 14:33:26 -0500

If there is a better newsgroup for this, please let me know. I also cannot
seem to get to the MSDN forums; the page never loads...

We have an ASP.NET 2.0 application that uses the AJAX Extensions and the
AJAX Control Toolkit. Many of our pages use JavaScript confirm dialogs for
standard "Are you sure" messages. One of our users is running IE 7 on Vista
Business. The following code displays the confirm correctly, but the cancel
response is essentially ignored and the user is taken to page2.html. This
exact same code works on Vista Home Premium w/IE 7 and WinXP w/IE, Firefox,
Opera, and Safari. It also works on the Vista Business machine with
Firefox, so we are fairly certain this is an IE 7 / Vista Business issue.

Any thoughts on what it could be? We perused the options available for IE
and none drew our attention as being a possible culprit. The other
JavaScript code in the application has been executing as expected.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Page 1</title>
</head>
<body>
<form action="Page2.htm" method="post">
<h1>You are now on page 1</h1>
<input type="submit" onclick="return confirm('Are you sure you want to go
to page 2?');" value="Click here for page 2">
</form>
</body>
</html>



************* Page2.htm ****************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<h1>You are now on page 2</h1>
<a href="Page1.htm">Back To Page 1</a>
</body>
</html>


Mike Placentra II
Posted: Thursday, October 04, 2007 9:42:06 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 04/10/2007 21:42:06
Date: Thu, 04 Oct 2007 21:42:06 -0000

On Oct 4, 3:33 pm, "Chris Walls" <chwal...@community.nospam> wrote:
> If there is a better newsgroup for this, please let me know. I also cannot
> seem to get to the MSDN forums; the page never loads...
>
> We have an ASP.NET 2.0 application that uses the AJAX Extensions and the
> AJAX Control Toolkit. Many of our pages use JavaScript confirm dialogs for
> standard "Are you sure" messages. One of our users is running IE 7 on Vista
> Business. The following code displays the confirm correctly, but the cancel
> response is essentially ignored and the user is taken to page2.html. This
> exact same code works on Vista Home Premium w/IE 7 and WinXP w/IE, Firefox,
> Opera, and Safari. It also works on the Vista Business machine with
> Firefox, so we are fairly certain this is an IE 7 / Vista Business issue.
>
> Any thoughts on what it could be? We perused the options available for IE
> and none drew our attention as being a possible culprit. The other
> JavaScript code in the application has been executing as expected.

As it seems you're working directly with the HTML form element anyway,
I'd suggest putting your confirm JavaScript in the form's onSubmit
attribute (onsubmit xHTML of course).

-Michael Placentra II

Steven Cheng[MSFT]
Posted: Friday, October 05, 2007 4:04:32 AM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 05/10/2007 04:04:32
Date: Fri, 05 Oct 2007 04:04:32 GMT

Hi Chris,

As other members have mentioned, the problem is likely tighted to the
certain machine. I've also tested the pages on my local box(with VISTA
business + IE7), the cancel behavior works correct(won't navigate to
page2). You can also try it on some other boxes to see the behavior.
Also, will the other alternative suggestions mentioned work for you?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.



>Date: Thu, 04 Oct 2007 15:04:46 -0700
>From: bruce barker <nospam@nospam.com>
>Subject: Re: Vista, IE7, and cancelling an onclick event

>
>IE has a long standing bug where this happens (back to 5.5). Never sure
>what triggers it, you will find it works on another box with the same
>software.
>
>anyway the fix is easy, but causes trouble if you need event bubbling
>(not in your case). add the following function to your page:
>
>function cancelEvent()
>{
> // ie only hack
> if (window.event) window.event.cancelBubble = true;
> // everyone else
> return false;
>}
>
>then change your onclick to:
>
><input type="submit"
> onclick="if(!confirm('blah...'))return cancelEvent();"
> value="Click here for page 2">
>
>
>
>-- bruce (sqlwork.com)
>
>
>Chris Walls wrote:
>> If there is a better newsgroup for this, please let me know. I also
cannot
>> seem to get to the MSDN forums; the page never loads...
>>
>> We have an ASP.NET 2.0 application that uses the AJAX Extensions and the
>> AJAX Control Toolkit. Many of our pages use JavaScript confirm dialogs
for
>> standard "Are you sure" messages. One of our users is running IE 7 on
Vista
>> Business. The following code displays the confirm correctly, but the
cancel
>> response is essentially ignored and the user is taken to page2.html.
This
>> exact same code works on Vista Home Premium w/IE 7 and WinXP w/IE,
Firefox,
>> Opera, and Safari. It also works on the Vista Business machine with
>> Firefox, so we are fairly certain this is an IE 7 / Vista Business issue.
>>
>> Any thoughts on what it could be? We perused the options available for
IE
>> and none drew our attention as being a possible culprit. The other
>> JavaScript code in the application has been executing as expected.
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml" >
>> <head>
>> <title>Page 1</title>
>> </head>
>> <body>
>> <form action="Page2.htm" method="post">
>> <h1>You are now on page 1</h1>
>> <input type="submit" onclick="return confirm('Are you sure you want to
go
>> to page 2?');" value="Click here for page 2">
>> </form>
>> </body>
>> </html>
>>
>>
>>
>> ************* Page2.htm ****************
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml" >
>> <head>
>> <title>Untitled Page</title>
>> </head>
>> <body>
>> <h1>You are now on page 2</h1>
>> <a href="Page1.htm">Back To Page 1</a>
>> </body>
>> </html>
>>
>>
>

Chris Walls
Posted: Friday, October 05, 2007 5:09:18 AM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 05/10/2007 05:09:18
Date: Fri, 5 Oct 2007 10:09:18 -0500

We've been using the same basic JavaScript library for going on 10 years now
and this is the first time we've experienced this. Bruce's suggestion may
work for us so we'll give that a shot. The problem with Mike's sugestion is
that it only addresses the simple example. We have application pages with
multiple buttons that require different types of user confirmation, plus we
have other functionality hooking into the form's onsubmit event.

Is there anything we can provide to MS to help diagnose the problem? We've
found several posts where someone complained about the same issue, though
each posting had responses from others that they could not reproduce the
issue with the same software configuration. So we believe this is an issue,
though obviously very difficult to reproduce.

Thanks to all for the suggestions.

- Chris

"Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
news:dsbDdTwBIHA.4200@TK2MSFTNGHUB02.phx.gbl...
> Hi Chris,
>
> As other members have mentioned, the problem is likely tighted to the
> certain machine. I've also tested the pages on my local box(with VISTA
> business + IE7), the cancel behavior works correct(won't navigate to
> page2). You can also try it on some other boxes to see the behavior.
> Also, will the other alternative suggestions mentioned work for you?
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> --------------------
>>Date: Thu, 04 Oct 2007 15:04:46 -0700
>>From: bruce barker <nospam@nospam.com>
>>Subject: Re: Vista, IE7, and cancelling an onclick event
>
>>
>>IE has a long standing bug where this happens (back to 5.5). Never sure
>>what triggers it, you will find it works on another box with the same
>>software.
>>
>>anyway the fix is easy, but causes trouble if you need event bubbling
>>(not in your case). add the following function to your page:
>>
>>function cancelEvent()
>>{
>> // ie only hack
>> if (window.event) window.event.cancelBubble = true;
>> // everyone else
>> return false;
>>}
>>
>>then change your onclick to:
>>
>><input type="submit"
>> onclick="if(!confirm('blah...'))return cancelEvent();"
>> value="Click here for page 2">
>>
>>
>>
>>-- bruce (sqlwork.com)
>>
>>
>>Chris Walls wrote:
>>> If there is a better newsgroup for this, please let me know. I also
> cannot
>>> seem to get to the MSDN forums; the page never loads...
>>>
>>> We have an ASP.NET 2.0 application that uses the AJAX Extensions and the
>>> AJAX Control Toolkit. Many of our pages use JavaScript confirm dialogs
> for
>>> standard "Are you sure" messages. One of our users is running IE 7 on
> Vista
>>> Business. The following code displays the confirm correctly, but the
> cancel
>>> response is essentially ignored and the user is taken to page2.html.
> This
>>> exact same code works on Vista Home Premium w/IE 7 and WinXP w/IE,
> Firefox,
>>> Opera, and Safari. It also works on the Vista Business machine with
>>> Firefox, so we are fairly certain this is an IE 7 / Vista Business
>>> issue.
>>>
>>> Any thoughts on what it could be? We perused the options available for
> IE
>>> and none drew our attention as being a possible culprit. The other
>>> JavaScript code in the application has been executing as expected.
>>>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>> <html xmlns="http://www.w3.org/1999/xhtml" >
>>> <head>
>>> <title>Page 1</title>
>>> </head>
>>> <body>
>>> <form action="Page2.htm" method="post">
>>> <h1>You are now on page 1</h1>
>>> <input type="submit" onclick="return confirm('Are you sure you want to
> go
>>> to page 2?');" value="Click here for page 2">
>>> </form>
>>> </body>
>>> </html>
>>>
>>>
>>>
>>> ************* Page2.htm ****************
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>> <html xmlns="http://www.w3.org/1999/xhtml" >
>>> <head>
>>> <title>Untitled Page</title>
>>> </head>
>>> <body>
>>> <h1>You are now on page 2</h1>
>>> <a href="Page1.htm">Back To Page 1</a>
>>> </body>
>>> </html>
>>>
>>>
>>
>


Steven Cheng[MSFT]
Posted: Monday, October 08, 2007 2:39:04 AM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 08/10/2007 02:39:04
Date: Mon, 08 Oct 2007 02:39:04 GMT

Hi Chris,

Yes, the bigest problem here is such problems are quite hard to repro. For
MS product support guys to troubleshoot on this, it will surely need to
have stable reproable environment so as to perform tests. Also, normally,
they'll peform tests on local side first, but as you know, such problems is
not likely to be reproable there.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.



>From: "Chris Walls" <chwalls2@community.nospam>
>Subject: Re: Vista, IE7, and cancelling an onclick event
>Date: Fri, 5 Oct 2007 10:09:18 -0500

>We've been using the same basic JavaScript library for going on 10 years
now
>and this is the first time we've experienced this. Bruce's suggestion may
>work for us so we'll give that a shot. The problem with Mike's sugestion
is
>that it only addresses the simple example. We have application pages with
>multiple buttons that require different types of user confirmation, plus
we
>have other functionality hooking into the form's onsubmit event.
>
>Is there anything we can provide to MS to help diagnose the problem?
We've
>found several posts where someone complained about the same issue, though
>each posting had responses from others that they could not reproduce the
>issue with the same software configuration. So we believe this is an
issue,
>though obviously very difficult to reproduce.
>
>Thanks to all for the suggestions.
>
>- Chris
>
>"Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
>news:dsbDdTwBIHA.4200@TK2MSFTNGHUB02.phx.gbl...
>> Hi Chris,
>>
>> As other members have mentioned, the problem is likely tighted to the
>> certain machine. I've also tested the pages on my local box(with VISTA
>> business + IE7), the cancel behavior works correct(won't navigate to
>> page2). You can also try it on some other boxes to see the behavior.
>> Also, will the other alternative suggestions mentioned work for you?
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> --------------------
>>>Date: Thu, 04 Oct 2007 15:04:46 -0700
>>>From: bruce barker <nospam@nospam.com>
>>>Subject: Re: Vista, IE7, and cancelling an onclick event
>>
>>>
>>>IE has a long standing bug where this happens (back to 5.5). Never sure
>>>what triggers it, you will find it works on another box with the same
>>>software.
>>>
>>>anyway the fix is easy, but causes trouble if you need event bubbling
>>>(not in your case). add the following function to your page:
>>>
>>>function cancelEvent()
>>>{
>>> // ie only hack
>>> if (window.event) window.event.cancelBubble = true;
>>> // everyone else
>>> return false;
>>>}
>>>
>>>then change your onclick to:
>>>
>>><input type="submit"
>>> onclick="if(!confirm('blah...'))return cancelEvent();"
>>> value="Click here for page 2">
>>>
>>>
>>>
>>>-- bruce (sqlwork.com)
>>>
>>>
>>>Chris Walls wrote:
>>>> If there is a better newsgroup for this, please let me know. I also
>> cannot
>>>> seem to get to the MSDN forums; the page never loads...
>>>>
>>>> We have an ASP.NET 2.0 application that uses the AJAX Extensions and
the
>>>> AJAX Control Toolkit. Many of our pages use JavaScript confirm dialogs
>> for
>>>> standard "Are you sure" messages. One of our users is running IE 7 on
>> Vista
>>>> Business. The following code displays the confirm correctly, but the
>> cancel
>>>> response is essentially ignored and the user is taken to page2.html.
>> This
>>>> exact same code works on Vista Home Premium w/IE 7 and WinXP w/IE,
>> Firefox,
>>>> Opera, and Safari. It also works on the Vista Business machine with
>>>> Firefox, so we are fairly certain this is an IE 7 / Vista Business
>>>> issue.
>>>>
>>>> Any thoughts on what it could be? We perused the options available for
>> IE
>>>> and none drew our attention as being a possible culprit. The other
>>>> JavaScript code in the application has been executing as expected.
>>>>
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>> <html xmlns="http://www.w3.org/1999/xhtml" >
>>>> <head>
>>>> <title>Page 1</title>
>>>> </head>
>>>> <body>
>>>> <form action="Page2.htm" method="post">
>>>> <h1>You are now on page 1</h1>
>>>> <input type="submit" onclick="return confirm('Are you sure you want to
>> go
>>>> to page 2?');" value="Click here for page 2">
>>>> </form>
>>>> </body>
>>>> </html>
>>>>
>>>>
>>>>
>>>> ************* Page2.htm ****************
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>> <html xmlns="http://www.w3.org/1999/xhtml" >
>>>> <head>
>>>> <title>Untitled Page</title>
>>>> </head>
>>>> <body>
>>>> <h1>You are now on page 2</h1>
>>>> <a href="Page1.htm">Back To Page 1</a>
>>>> </body>
>>>> </html>
>>>>
>>>>
>>>
>>
>
>
>

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.1 (NET v2.0) - 9/10/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.110 seconds.