I want to put a condition that text field does not accept numbers

In the expense Item name field I don't want that the user can put there numbers. If done, It should return error as "don't put numbers in the text field. "

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You have the option of either cleanwith or stripwith.

    One whitelists, the other blacklists.

    Blacklist means you have a list of characters that are NOT allowed, in your case your blacklist would be {1,2,3,4,5,6,7,8,9,10}.  The problem is that you allow EVERYTHING not in the blacklist, so you have to enumerate everything in the universe you don't want to allow.  People can still input A, or Ç, or Ц, or ㅂ, or き or Stuck out tongue or Crossed swords️ or Rocket or (╯°□°)╯︵ ┻━┻ into your text field.  There's a world absolutely full of what you don't want.

    Whitelisting is much safer; it's the exact opposite, a list of all the characters that ARE allowed, in your specifically worded case only {abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}  You DISALLOW everything not in the whitelist.  It looks like a lot, but now your users can really use "only letters" and all the examples above AND numbers will all fail to be input.  Whitelisting is much safer because it accounts for everything you thought of and everything you didn't think of too.

  • 0
    Certified Senior Developer
    in reply to Dave Lewis

    like it. Very valuable input :)   Thank you davidl280

Reply Children
No Data