Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Textbox control - limiting input

Reply
Thread Tools

Textbox control - limiting input

 
 
LAL
Guest
Posts: n/a
 
      01-15-2004
Greetings...

I'm pretty new to ASP.NET programming and I have two questions:

1. How can I automatically change what it typed into a text box to upper
case as the user is typing on the webpage?

I tried the following suggestion
http://www.dotnet247.com/247referenc...33/166114.aspx
(Basically add a script to call .ToUpperCase on the value of control passed
in, the call this script in onKeyUp event)
but onKeyUp doesn't appear to be a recognized event on the TextBox control.

2. Is there a way to limit what the user types to be numeric characters
only? In other word, 1234567890 would be the only accepted characters?

Thanx!
LAL


 
Reply With Quote
 
 
 
 
LAL
Guest
Posts: n/a
 
      01-19-2004
Greetings...

So what you're saying is, "It can't be done." *deep sigh* It sounded like
such an easy request. Oh well.

LAL
"Seb" <(E-Mail Removed)> wrote in message
news:eo1Ob.11479$(E-Mail Removed) link.net...
> This cannot be done on a webpage regardless of ASP.NET. The client side of

a
> web page is automated by javascript. The onChange event will fire in
> Javascript as the user selects, clicks, or tabs to a control other than

your
> textbox. This is when the event will fire and when you can change the

case
> of your textbox.
>
> "LAL" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > Greetings...
> >
> > I'm pretty new to ASP.NET programming and I have two questions:
> >
> > 1. How can I automatically change what it typed into a text box to upper
> > case as the user is typing on the webpage?
> >
> > I tried the following suggestion
> > http://www.dotnet247.com/247referenc...33/166114.aspx
> > (Basically add a script to call .ToUpperCase on the value of control

> passed
> > in, the call this script in onKeyUp event)
> > but onKeyUp doesn't appear to be a recognized event on the TextBox

> control.
> >
> > 2. Is there a way to limit what the user types to be numeric characters
> > only? In other word, 1234567890 would be the only accepted characters?
> >
> > Thanx!
> > LAL
> >
> >

>
>



 
Reply With Quote
 
 
 
 
Dan Forster
Guest
Posts: n/a
 
      01-21-2004
For Q 2:

You can use the following javascript:

function nb_numeralsOnly(evt)

{

evt = (evt) ? evt : event;

var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode
: ((evt.which) ? evt.which : 0));

if (charCode > 31 && (charCode < 48 || charCode >57)) {return false;}

return true;

}

and bind :

onkeypress='return nb_numeralsOnly(event);'

for Question 1 you could use:

function setUpper(evt)
{

evt = (evt) ? evt : event;
var kc = evt.keyCode;
if (kc>96 && kc<123)
{
evt.keyCode=kc-32;
}
return true;
}

This will still allow other characters but translates lower case
non-accented latin characters to upper case while typing.

bind in the same way as above.

onkeypress='return setUpper(event);'

Dan

"LAL" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Greetings...
>
> So what you're saying is, "It can't be done." *deep sigh* It sounded

like
> such an easy request. Oh well.
>
> LAL
> "Seb" <(E-Mail Removed)> wrote in message
> news:eo1Ob.11479$(E-Mail Removed) link.net...
> > This cannot be done on a webpage regardless of ASP.NET. The client side

of
> a
> > web page is automated by javascript. The onChange event will fire in
> > Javascript as the user selects, clicks, or tabs to a control other than

> your
> > textbox. This is when the event will fire and when you can change the

> case
> > of your textbox.
> >
> > "LAL" <(E-Mail Removed)> wrote in message
> > news:#(E-Mail Removed)...
> > > Greetings...
> > >
> > > I'm pretty new to ASP.NET programming and I have two questions:
> > >
> > > 1. How can I automatically change what it typed into a text box to

upper
> > > case as the user is typing on the webpage?
> > >
> > > I tried the following suggestion
> > > http://www.dotnet247.com/247referenc...33/166114.aspx
> > > (Basically add a script to call .ToUpperCase on the value of control

> > passed
> > > in, the call this script in onKeyUp event)
> > > but onKeyUp doesn't appear to be a recognized event on the TextBox

> > control.
> > >
> > > 2. Is there a way to limit what the user types to be numeric

characters
> > > only? In other word, 1234567890 would be the only accepted

characters?
> > >
> > > Thanx!
> > > LAL
> > >
> > >

> >
> >

>
>



 
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
6500: User-Based Rate Limiting AND Total Rate Limiting Patrick Cervicek Cisco 0 08-07-2007 03:07 PM
Textbox, Input (text) on turbotax... anyone know which 3rd party textbox this is??? pld888@gmail.com ASP .Net 3 02-23-2007 08:51 PM
limiting # of characters for a multiline mode textbox Paul ASP .Net Web Controls 3 07-07-2005 07:32 PM
Limiting Multiline textbox Neven Klofutar ASP .Net 6 11-22-2004 09:20 PM
Re: VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail??? S. Justin Gengo ASP .Net 0 07-16-2003 06:51 PM



Advertisments