SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Ireland
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text Case validation

    Hi Folks, I am looking for a JavaScript code that will validate whether text input upper/lowercase?

    Thanks if you can help

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you give a little more detail into your "validation"?

  3. #3
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Ireland
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am looking for scripts that will validate the input of a text box

    1)to only allow uppercase or lowercase a-z
    2)to only allow a number?
    3)to allow (_ or *)

    Hope you can help

    Regards
    Foxy

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="text" onblur="if(/[^\w\d\*\.]/g.test(this.value)){alert('Invalid characters found');this.focus()}" />

    That will see if any character other than:
    a-z A-Z 0-9 . * _
    is present, and if so, will alert the user and focus the text.
    Jason - Contact Me
    Supermoderator @ CodingForums

  5. #5
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice one jkd
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  6. #6
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Ireland
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jason I will try that.

    regards
    Foxy

  7. #7
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone know how to do this in VBScript?

  8. #8
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    moospot that's Regular Expressions too, so you could take that pattern and plug it into what I showed you in that Server Side Scripting thread, except you use the "Test" method instead of the "Replace" method. Should return True or False.

  9. #9
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Gotcha, I just pulled out my Beginning Active Server Pages 3.0 book and read up on the RegExp Object. It was exaclty what I needed.

    Again, thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •