By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,883 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,883 IT Pros & Developers. It's quick & easy.

What event fires when user uses Alt & numeric key pad to enter text into a textbox

P: n/a
In our application, we've added a bit of JavaScript that updates a title as
the user types into a textbox. To trigger this, we patch into the "onkeyup"
and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "".

Anyone got any idea which, if, any event to handle for this situation?

Thanks, Rob.
Nov 19 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
what about the event for when text changes, I think 'onchange' or
'ontextchange' or something like that

"Rob Nicholson" <in******@community.nospam> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...
In our application, we've added a bit of JavaScript that updates a title
as
the user types into a textbox. To trigger this, we patch into the
"onkeyup"
and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "".

Anyone got any idea which, if, any event to handle for this situation?

Thanks, Rob.

Nov 19 '05 #2

P: n/a

"Rob Nicholson" wrote:
In our application, we've added a bit of JavaScript that updates a title as
the user types into a textbox. To trigger this, we patch into the "onkeyup"
and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "á".

Anyone got any idea which, if, any event to handle for this situation?


OnKeyPress

<html><body>
<SCRIPT>
function fnKeyPress()
{
oFirstNameCopy.value += String.fromCharCode(event.keyCode);
}
</SCRIPT>
<table>
<tr>
<td>First Name</td>
<td>
<INPUT ID="oFirstName" TYPE="text" onKeyPress="fnKeyPress();">
</td>
<td>
Copy of First Name
</td>
<td>
<INPUT ID="oFirstNameCopy" TYPE="text" >
</td>
</tr>
</table>
</body>
</html>

--
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
Nov 19 '05 #3

P: n/a
> In our application, we've added a bit of JavaScript that updates a title
as
the user types into a textbox. To trigger this, we patch into the "onkeyup" and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "".

Anyone got any idea which, if, any event to handle for this situation?


This was posted with a MSDN friendly email address - isn't somebody from
Microsoft supposed to comment?

Thanks, Rob.
Nov 19 '05 #4

P: n/a
> what about the event for when text changes, I think 'onchange' or
'ontextchange' or something like that


onchange will fire but only when the text box looses focus. However, I think
this will have to be a workaround for now.

Thanks, Rob.
Nov 19 '05 #5

P: n/a
> OnKeyPress

Are you Bobby Moore? :-) I'll check - we're handling onkeyup but will try
onkeypress.

Thanks, Rob.
Nov 19 '05 #6

P: n/a
Rob Nicholson wrote:

This was posted with a MSDN friendly email address - isn't somebody
from Microsoft supposed to comment?

I think they only comment when the post has not received a useful reply.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 19 '05 #7

P: n/a
Hi Rob,

Frankly speaking, I think other community members' suggestion has been very
complete. For the Alt- number scenario, neither keydown or keyup(keypress)
will work. Currently the only workaround is the "onchange" event though it
only fire when the focus leave the entry field. Seems we are limited to
these clientside events now.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom>
| References: <OJ**************@TK2MSFTNGP15.phx.gbl>
<On**************@tk2msftngp13.phx.gbl>
| Subject: Re: What event fires when user uses Alt & numeric key pad to
enter text into a textbox
| Date: Thu, 18 Aug 2005 18:50:21 -0400
| Lines: 14
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <OW*************@TK2MSFTNGP15.phx.gbl>
| Newsgroups:
microsoft.public.dotnet.framework.aspnet,microsoft .public.dotnet.languages.j
script,microsoft.public.inetsdk.programming.script ing.jscript
| NNTP-Posting-Host: 66-189-67-134.dhcp.oxfr.ma.charter.com 66.189.67.134
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.languages.jscript:1344
microsoft.public.inetsdk.programming.scripting.jsc ript:1077
microsoft.public.dotnet.framework.aspnet:119006
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Rob Nicholson wrote:
| >
| > This was posted with a MSDN friendly email address - isn't somebody
| > from Microsoft supposed to comment?
| >
| I think they only comment when the post has not received a useful reply.
|
| --
| Microsoft MVP - ASP/ASP.NET
| Please reply to the newsgroup. This email account is my spam trap so I
| don't check it very often. If you must reply off-line, then remove the
| "NO SPAM"
|
|
|

Nov 19 '05 #8

P: n/a
> I think they only comment when the post has not received a useful reply.

Hmm :-) onkeypress doesn't trigger when ALT input option is used. We'll put
up with onchange firing when the user moves focus outside of the textbox.

Cheers, Rob.
Nov 19 '05 #9

P: n/a
> Frankly speaking, I think other community members' suggestion has been
very
complete. For the Alt- number scenario, neither keydown or keyup(keypress)


I'm just trying to understand what level of support I get via the newsgroups
as a MSDN subscriber. To be frank myself, the other community members could
have given completely false information :-) I realise they haven't in this
instance and that in a majority of time the answers are accurate and
informative. But I would have hoped for that clarification by a Microsoft
support person.

As an example, somebody could have said "if you use VB script instead, you
can capture this event". Sounds perfectly reasonable doesn't it.

I'm not trying to be awkward but this newsgroup is completely open and
therefore any "stamp of approval" via a Microsoft support person is
welcomed.

Cheers, Rob.
Nov 19 '05 #10

P: n/a
Thanks for your followup and the feedback,

Sure, we'll be willing to post our suggestions even if sometimes community
members have provided some general ideas. Anyway, I still think community
and MVP would be the main energy of newsgroup :-)

Thanks again for your posting.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Rob Nicholson" <in******@community.nospam>
| References: <OJ**************@TK2MSFTNGP15.phx.gbl>
<On**************@tk2msftngp13.phx.gbl>
<OW*************@TK2MSFTNGP15.phx.gbl>
<mv*************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: What event fires when user uses Alt & numeric key pad to
enter text into a textbox
| Date: Mon, 22 Aug 2005 18:18:59 +0100
| Lines: 21
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.181
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.181
| Message-ID: <ed*************@TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: host217-45-2-106.in-addr.btopenworld.com 217.45.2.106
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGP08.phx.gbl!TK2MSFTNGP1
4.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:338925
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| > Frankly speaking, I think other community members' suggestion has been
| very
| > complete. For the Alt- number scenario, neither keydown or
keyup(keypress)
|
| I'm just trying to understand what level of support I get via the
newsgroups
| as a MSDN subscriber. To be frank myself, the other community members
could
| have given completely false information :-) I realise they haven't in this
| instance and that in a majority of time the answers are accurate and
| informative. But I would have hoped for that clarification by a Microsoft
| support person.
|
| As an example, somebody could have said "if you use VB script instead, you
| can capture this event". Sounds perfectly reasonable doesn't it.
|
| I'm not trying to be awkward but this newsgroup is completely open and
| therefore any "stamp of approval" via a Microsoft support person is
| welcomed.
|
| Cheers, Rob.
|
|
|

Nov 19 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.