Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript Quickie

  • 20-10-2006 8:31am
    #1
    Registered Users, Registered Users 2 Posts: 648 ✭✭✭


    hi

    when someone fills in a username field i dont want them to have spaces or special characters

    i found a function


    function f(o){
    o.value=o.value.toUpperCase().replace(/([^0-9A-Z])/g,"");
    }


    however this changes the letters to capitals - anyone know how i can allow upper and lower caps, no spaces or special characters?


Comments

  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    isnt it something like this?

    function f(o){
    o.value=o.value.toUpperCase().replace(/([^0-9a-zA-Z])/g,"");
    }


    incidently I would suggest you have a look at this

    http://www.massimocorner.com/validator/ - I find it one of the best form validation scripts out there


  • Registered Users, Registered Users 2 Posts: 82 ✭✭skidpatches


    o.value=o.value.replace(/([^0-9A-Za-z])/g,"");


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    skidpatches is right - get rid of the toUpperCase()


  • Registered Users, Registered Users 2 Posts: 648 ✭✭✭ChicoMendez


    Tnx Lads


Advertisement