The normal function of the textbox on tab out when the value has changed is
to fire onchange then onblur. When the value changes and I hit enter key,
onkeypress runs then onblur, but not onchange. The event is not raised. I
have added event listeners using attachEvent (which fires during tab out)
and it won't get called either.
I can't just call onchange() from the onkeypress handler because it will
always run even when the value doesnt change (I do a postback onchange so I
cant have it run unless the value really does change)
Please help me as I dont know what else to do.
thanks
MSDN IE Development Forums <=post such questions here instead
http://social.msdn.microsoft.com/forums/en-US/category/iedevelopment/
IE Developer Center
http://msdn.microsoft.com/en-us/ie/default.aspx
Learn IE8
http://msdn.microsoft.com/en-us/ie/aa740473.aspx
HTML and DHTML Overviews and Tutorials
http://msdn.microsoft.com/en-us/library/ms537623.aspx and
Cascading Style Sheets (CSS)
http://msdn2.microsoft.com/en-us/ie/aa740476.aspx
Expression Web SuperPreview for Internet Explorer (free, stand-alone visual
debugging tool for IE6, IE7, and IE8)
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677
Expression Web SuperPreview Release Notes
http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes.aspx
Validators:
http://validator.w3.org/
http://jigsaw.w3.org/css-validator/
--
~Robear Dyer (PA Bear)
MS MVP-IE, Mail, Security, Windows Client - since 2002
www.banthecheck.com
If press the enter key, it will trigger onkeypress event and do submit
directly without going through onblur and onchange event at all.
If you'd like to press enter key to do the postback only if the textbox
value is changed, you can store the old value and do the submit if the
value is changed in keypress event.
Please check the following code if it is what you want.
<asp:TextBox id="text1" runat="server" />
<script type="text/javascript">
var oldvalue = "";
function window.onload() {
var textbox = document.getElementById('text1');
oldvalue = textbox.value;
textbox.onkeypress = onkeypressed;
}
function onkeypressed(e) {
var newvalue = document.getElementById('text1').value;
e = window.event || e;
var k = e.keyCode || e.which;
if (k == 13 && oldvalue == newvalue)
return false;
oldvalue = newvalue;
}
</script>
--
Sincerely,
Vince Xu
Microsoft Online Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
--------------------
| From: "TS" <manofs...@nospam.nospam>
| Subject: IE 7 won't call onchange after onkeypress fires (using enter key)
| Date: Wed, 2 Dec 2009 10:28:14 -0600
| Lines: 21
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
| Message-ID: <#OHN0x2c...@TK2MSFTNGP06.phx.gbl>
| Newsgroups:
microsoft.public.inetexplorer.scripting,microsoft.public.internetexplorer.ge
neral,microsoft.public.scripting.jscript
| NNTP-Posting-Host: 168.38.106.109
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP06.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.internetexplorer.general:132100
microsoft.public.scripting.jscript:4104
microsoft.public.inetexplorer.scripting:672
| X-Tomcat-NG: microsoft.public.scripting.jscript
Did you resolve this issue?
This is Vince Xu from MSDN Managed Newsgroup support team, since I
haven't seen your reply after I last posted my reply. Please feel free
to let me know if there's anything else I can help. Thanks.
--
Sincerely,
Vince Xu
Microsoft Online Support
--------------------
| From: "TS" <manofs...@nospam.nospam>
| Subject: IE 7 won't call onchange after onkeypress fires (using enter key)
| Date: Wed, 2 Dec 2009 10:28:14 -0600
| Lines: 21
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
| Message-ID: <#OHN0x2c...@TK2MSFTNGP06.phx.gbl>
| Newsgroups:
microsoft.public.inetexplorer.scripting,microsoft.public.internetexplorer.ge
neral,microsoft.public.scripting.jscript
| NNTP-Posting-Host: 168.38.106.109
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP06.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.internetexplorer.general:132100
microsoft.public.scripting.jscript:4104
microsoft.public.inetexplorer.scripting:672
| X-Tomcat-NG: microsoft.public.scripting.jscript
|