Solved

Uppercase Form Function

Posted on 2002-05-28
6
508 Views
Last Modified: 2008-03-04
I am working in ASP with VBScript. I have a form which includes a licence plate field as such:

Licence Plate:
<input type="text" name="BlackLP" size="40"><br>
<input type="submit" value="SUBMIT" id="submit1" name="submit1" onClick="return validate()">

The customer gave me this snippet of code to have licence plate numbers revert to capitols as we

type them in. Here is his message and code:

Can you trap the keystrokes so that you can only enter uppercase letters and numbers for the LP.  

Here is the snippet of code we use:
 
Private Sub txtLP_KeyPress(KeyAscii As Integer)
 
    Dim c$
    Dim n%
   
    If KeyAscii <> 8 Then    ' backspace
        n = 0
        If Len(txtLP) <= 12 Then
            c = Chr$(KeyAscii)
            c = UCase(c)
            If c < "A" Or c > "Z" Then
                If IsNumeric(c) Then
                    n = Asc(c)
                End If
            Else
                n = Asc(c)
            End If
        End If
        KeyAscii = n
    End If
 
End Sub

I do not know how to adapt it to the form in ASP and call it up. Can anyone help me?

Thank you
thunderain
0
Comment
Question by:thunderain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Expert Comment

by:zombeen
ID: 7041024
try this :-
Calling the function on keypress event of the associated textbox
<input type="text" name="BlackLP" size="40" onkeypress="txtLP_KeyPress(KeyAscii)"

Zombeen
0
 
LVL 30

Expert Comment

by:third
ID: 7041057
what browser's do you need to support? using styles is the easiest way.

<input type="text" name="BlackLP" size="40" style="text-transform:uppercase">
0
 
LVL 2

Accepted Solution

by:
zombeen earned 100 total points
ID: 7041070
or another way wud be to let the user enter in any case, but store in upper case by using ucase()

Zombeen
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:thunderain
ID: 7043669
I already tried ucase(), but he wants the keystrokes trapped and put in uppercase as you type. (style make kestrokes uppercase in some browsers). The code also keeps out symbol keys. He would like this used or modified if possible.

I renamed the function --> Function txtLP_KeyPress(KeyAscii)

I tried --> onkeypress="txtLP_KeyPress(KeyAscii)" but get errors, KeyAscii is undefined.

I put in BlackLP in both places, get error --> Object expected

I think using onkeypress is close, just not quite set up right.

Again, is there a way to call this function? Am i declaring the function wrong at the top? (Function txtLP_KeyPress(KeyAscii) OR Function txtLP_KeyPress(BlackLP)

thank you
thunderain


0
 
LVL 15

Expert Comment

by:gladxml
ID: 8854480
No comment has been added lately and it seems that this question have been abandoned. So it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question or invite a Moderator to close this question if there's no reply from you after seven days.

In the absence of responses, I will recommend the following:

To accept the comment and points awarded to  zombeen


** PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER **


Just trying to help for the cleanup...
gladxml
0
 
LVL 2

Expert Comment

by:zombeen
ID: 8867291
thks gladxml
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Date on a table 16 46
Replace value 2 55
PHP encrypted string and passing to a ASP Page 12 89
StoredProcedure to JSON query faulty syntax 2 45
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question