Welcome Guest, Not a member yet? Register   Sign In
Adding alpha_spaces_dashes as a native validation rule

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.

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".

(This post was last modified: 10-16-2016, 05:49 AM by PaulD. Edit Reason: minor change )

There are some good examples given here:

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.

PaulD, thanks for your thoughts. They were helpful.

Theme © iAndrew 2016 - Forum software by © MyBB