Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Display Text in Upper Case

Reply
 
Old 05-31-2009   #1 (permalink)
Antonette


 
 

Display Text in Upper Case

Sorry guys my Javascript is very limited!

I must have the educator enter some data as upper case. I have fought with
this for four days now and realize I need some help.

First question; Is there any way I can do this without using Javascript?

Here is my current scripting code.

function changeToUpperCase(onKeyUp)
{
document.getElementById(onChange).value.toUpperCase();
}

<Input Type="Text" Name="txtBlChip" Id="txtBlChip" Size="1" MaxLength="1"
Value="S" onKeyUp="changeToUpperCase(this.txtBlChip)"
onChange="changeToUpperCase(this.txtBlChip)">

What am I doing wrong?

Thanks in advance

Toni



My System SpecsSystem Spec
Old 05-31-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Display Text in Upper Case


"Antonette" <Antonette@xxxxxx> wrote in message
news:E657E382-885B-4868-8D0A-71099F89D624@xxxxxx
Quote:

> Sorry guys my Javascript is very limited!
>
> I must have the educator enter some data as upper case. I have fought
> with
> this for four days now and realize I need some help.
>
> First question; Is there any way I can do this without using Javascript?
>
> Here is my current scripting code.
>
> function changeToUpperCase(onKeyUp)
> {
> document.getElementById(onChange).value.toUpperCase();
> }
>
> <Input Type="Text" Name="txtBlChip" Id="txtBlChip" Size="1" MaxLength="1"
> Value="S" onKeyUp="changeToUpperCase(this.txtBlChip)"
> onChange="changeToUpperCase(this.txtBlChip)">
>
> What am I doing wrong?
>
> Thanks in advance
>
> Toni
I would repost in a Java newsgroup.


My System SpecsSystem Spec
Old 05-31-2009   #3 (permalink)
Antonette


 
 

Re: Display Text in Upper Case

I want to reiterate - can this be done without using JScript or Java?

Thank You.

"Pegasus [MVP]" wrote:
Quote:

>
> "Antonette" <Antonette@xxxxxx> wrote in message
> news:E657E382-885B-4868-8D0A-71099F89D624@xxxxxx
Quote:

> > Sorry guys my Javascript is very limited!
> >
> > I must have the educator enter some data as upper case. I have fought
> > with
> > this for four days now and realize I need some help.
> >
> > First question; Is there any way I can do this without using Javascript?
> >
> > Here is my current scripting code.
> >
> > function changeToUpperCase(onKeyUp)
> > {
> > document.getElementById(onChange).value.toUpperCase();
> > }
> >
> > <Input Type="Text" Name="txtBlChip" Id="txtBlChip" Size="1" MaxLength="1"
> > Value="S" onKeyUp="changeToUpperCase(this.txtBlChip)"
> > onChange="changeToUpperCase(this.txtBlChip)">
> >
> > What am I doing wrong?
> >
> > Thanks in advance
> >
> > Toni
>
> I would repost in a Java newsgroup.
>
>
>
My System SpecsSystem Spec
Old 05-31-2009   #4 (permalink)
Bob Barrows


 
 

Re: Display Text in Upper Case

You could do it in your server-side code if you are using ASP.
You could also use a trigger on your database if you are storing this text
in a database that supports triggers.

Or, you could let the user enter the data any way he wants, but convert to
upper case whenever displaying it. This could be done in the sql statement
that retrieves the text from the database (if you are using a database) or
in your server-side code if you are using ASP.

Antonette wrote:
Quote:

> I want to reiterate - can this be done without using JScript or Java?
>
> Thank You.
>
> "Pegasus [MVP]" wrote:
>
Quote:

>>
>> "Antonette" <Antonette@xxxxxx> wrote in message
>> news:E657E382-885B-4868-8D0A-71099F89D624@xxxxxx
Quote:

>>> Sorry guys my Javascript is very limited!
>>>
>>> I must have the educator enter some data as upper case. I have
>>> fought with
>>> this for four days now and realize I need some help.
>>>
>>> First question; Is there any way I can do this without using
>>> Javascript?
>>>
>>> Here is my current scripting code.
>>>
>>> function changeToUpperCase(onKeyUp)
>>> {
>>> document.getElementById(onChange).value.toUpperCase();
>>> }
>>>
>>> <Input Type="Text" Name="txtBlChip" Id="txtBlChip" Size="1"
>>> MaxLength="1" Value="S" onKeyUp="changeToUpperCase(this.txtBlChip)"
>>> onChange="changeToUpperCase(this.txtBlChip)">
>>>
>>> What am I doing wrong?
>>>
>>> Thanks in advance
>>>
>>> Toni
>>
>> I would repost in a Java newsgroup.
--
Microsoft MVP - ASP/ASP.NET - 2004-2007
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"


My System SpecsSystem Spec
Old 05-31-2009   #5 (permalink)
Evertjan.


 
 

Re: Display Text in Upper Case

=?Utf-8?B?QW50b25ldHRl?= wrote on 31 mei 2009 in
microsoft.public.scripting.vbscript:
Quote:

> Sorry guys my Javascript is very limited!
>
> I must have the educator enter some data as upper case. I have fought
> with this for four days now and realize I need some help.
>
> First question; Is there any way I can do this without using
> Javascript?
>
> Here is my current scripting code.
>
> function changeToUpperCase(onKeyUp)
> {
> document.getElementById(onChange).value.toUpperCase();
==getElementById(onChange)==

onchange is not a pointer!!!

You will have to do something with the resulting string like sending it
back to the screen.
Quote:

> }
>
> <Input Type="Text" Name="txtBlChip" Id="txtBlChip" Size="1"
> MaxLength="1"
> Value="S" onKeyUp="changeToUpperCase(this.txtBlChip)"
> onChange="changeToUpperCase(this.txtBlChip)">
========this.txtBlChip======

txtBlChip is not a attribute of this.
Id is.
But you have the pointer to the <input> already in "this".

Do not include things that have nothing to do with your Q.

Use onblur. with onchange and onkeyup the textcursor will be set to the
end-of-string position at each key entry.
Quote:

> What am I doing wrong?
Lots of things. See above.


Try:
==========================================
<input
type="text" name="txtX" id="txtX" value="testvalue"
onBlur="changeToUpperCase(this)"
Quote:

>
function changeToUpperCase(x) {
x.value = x.value.toUpperCase();
};
==========================================





--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
My System SpecsSystem Spec
Old 05-31-2009   #6 (permalink)
Evertjan.


 
 

Re: Display Text in Upper Case

Evertjan. wrote on 31 mei 2009 in microsoft.public.scripting.vbscript:
Quote:

> =?Utf-8?B?QW50b25ldHRl?= wrote on 31 mei 2009 in
> microsoft.public.scripting.vbscript:
>
Quote:

>> Sorry guys my Javascript is very limited!
>>
>> I must have the educator enter some data as upper case. I have fought
>> with this for four days now and realize I need some help.
>>
>> First question; Is there any way I can do this without using
>> Javascript?
>>
>> Here is my current scripting code.
>>
>> function changeToUpperCase(onKeyUp)
>> {
>> document.getElementById(onChange).value.toUpperCase();
>
> ==getElementById(onChange)==
>
> onchange is not a pointer!!!
>
> You will have to do something with the resulting string like sending it
> back to the screen.
>
Quote:

>> }
>>
>> <Input Type="Text" Name="txtBlChip" Id="txtBlChip" Size="1"
>> MaxLength="1"
>> Value="S" onKeyUp="changeToUpperCase(this.txtBlChip)"
>> onChange="changeToUpperCase(this.txtBlChip)">
>
> ========this.txtBlChip======
>
> txtBlChip is not a attribute of this.
> Id is.
> But you have the pointer to the <input> already in "this".
>
> Do not include things that have nothing to do with your Q.
>
> Use onblur. with onchange and onkeyup the textcursor will be set to the
> end-of-string position at each key entry.
>
Quote:

>> What am I doing wrong?
>
> Lots of things. See above.
>
>
> Try:
> ==========================================
> <input
> type="text" name="txtX" id="txtX" value="testvalue"
> onBlur="changeToUpperCase(this)"
Quote:

>>
>
> function changeToUpperCase(x) {
> x.value = x.value.toUpperCase();
>};
> ==========================================
Oh, I see you are in the wrong NG for Javascript.

VBscript will only be usable in IE.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
My System SpecsSystem Spec
Old 05-31-2009   #7 (permalink)
Pegasus [MVP]


 
 

Re: Display Text in Upper Case


"Antonette" <Antonette@xxxxxx> wrote in message
news:8097C1F6-F53A-455E-823A-475E809A3807@xxxxxx
Quote:

>I want to reiterate - can this be done without using JScript or Java?
>
If you ask "Can this be done using VB Script" then here is a method:

sInput = "d:\temp\dir.txt"
sOutput = "d:\temp\dir.out"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oInput = oFSO.OpenTextFile(sInput)
Set oOutput = oFSO.CreateTextFile(sOutput,vbTrue)
sData = UCase(oInput.ReadAll)
oOutput.Write sData
oInput.Close
oOutput.Close

If it's user input rather than file input you wish to translate then you
could use the VB Script function "InputBox". However, moving between Java
and VB Script does not look like an elegant solution to me - asking the Java
experts how to do all of it in Java would give you a much cleaner method.


My System SpecsSystem Spec
Old 05-31-2009   #8 (permalink)
Antonette


 
 

Re: Display Text in Upper Case

Thank You very much, I am going to school this afternoon and I will try it.

Hope you have a great day.

"Evertjan." wrote:
Quote:

> Evertjan. wrote on 31 mei 2009 in microsoft.public.scripting.vbscript:
>
Quote:

> > =?Utf-8?B?QW50b25ldHRl?= wrote on 31 mei 2009 in
> > microsoft.public.scripting.vbscript:
> >
Quote:

> >> Sorry guys my Javascript is very limited!
> >>
> >> I must have the educator enter some data as upper case. I have fought
> >> with this for four days now and realize I need some help.
> >>
> >> First question; Is there any way I can do this without using
> >> Javascript?
> >>
> >> Here is my current scripting code.
> >>
> >> function changeToUpperCase(onKeyUp)
> >> {
> >> document.getElementById(onChange).value.toUpperCase();
> >
> > ==getElementById(onChange)==
> >
> > onchange is not a pointer!!!
> >
> > You will have to do something with the resulting string like sending it
> > back to the screen.
> >
Quote:

> >> }
> >>
> >> <Input Type="Text" Name="txtBlChip" Id="txtBlChip" Size="1"
> >> MaxLength="1"
> >> Value="S" onKeyUp="changeToUpperCase(this.txtBlChip)"
> >> onChange="changeToUpperCase(this.txtBlChip)">
> >
> > ========this.txtBlChip======
> >
> > txtBlChip is not a attribute of this.
> > Id is.
> > But you have the pointer to the <input> already in "this".
> >
> > Do not include things that have nothing to do with your Q.
> >
> > Use onblur. with onchange and onkeyup the textcursor will be set to the
> > end-of-string position at each key entry.
> >
Quote:

> >> What am I doing wrong?
> >
> > Lots of things. See above.
> >
> >
> > Try:
> > ==========================================
> > <input
> > type="text" name="txtX" id="txtX" value="testvalue"
> > onBlur="changeToUpperCase(this)"
Quote:

> >>
> >
> > function changeToUpperCase(x) {
> > x.value = x.value.toUpperCase();
> >};
> > ==========================================
>
> Oh, I see you are in the wrong NG for Javascript.
>
> VBscript will only be usable in IE.
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Display does not align text properly Vista General
Text display problem HELP PLEASE Vista General
Windows Update Won't Display Text Vista security
upper case I Vista performance & maintenance
Utility To Display CPU/Case/Motherboard Temps? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46