• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding alpha_spaces_dashes as a native validation rule

#1
Any thoughts on adding alpha_spaces_dashes as a native validation rule? 
Validating a persons last name is very common. Last names can include dashes and spaces but not numbers.
However, this common native validation rule seems to be omitted from the v3.10 list.
Reply

#2
You've forgotten about another somewhat common character in last names - the apostrophe.
And non-ASCII, non-latin letters.

Also, you think that a name cannot include a digit, but that's not true. It's uncommon that somebody would take advantage of that to the fullest extent, but quite a few countries will allow you to change your name to literally anything. That also includes having just a first name, or having more than 3 parts of a name.

The variations are countless, and it's impossible to fit everything in a single rule.

And also, there is no CodeIgniter version "3.10".
Reply

#3
There are some good examples given here:
http://stackoverflow.com/questions/23857...-last-name

But personally, I would just not validate it in that way (except for min_length, max_length and required of course).

As long as you are cleaning on output, there should be no problem with XSS.
Reply

#4
PaulD, thanks for your thoughts. They were helpful.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.