Welcome Guest, Not a member yet? Register   Sign In
Is there a bug with Class Validation ?
#1

[eluser]cPage[/eluser]
This is not working when i put some white space into client field ?

ABC inc not valid
ABCinc is valid

Code:
$this->form_validation->set_rules('client', ucfirst($this->lang->line('client')), 'required|alpha');
#2

[eluser]bigbusty[/eluser]
I'm not sure if thats the right answer but i think that whitespace is not considered alpha.

I've looked into the alpha function
Code:
return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE;

This method returns false, if there's whitespace in your string.
#3

[eluser]PhilTem[/eluser]
If you look at the user's guide and the description of option alpha you will see the following

Quote:Returns FALSE if the form element contains anything other than alphabetical characters.

which means, that any whitespace character is considered invalid. So there's no bug.
#4

[eluser]cPage[/eluser]
So, alpha it is good for string that required no space, like username.

That's what i thought thanks for the reply.




Theme © iAndrew 2016 - Forum software by © MyBB