CodeIgniter Forums
trim validation rules - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: trim validation rules (/showthread.php?tid=5228)

trim validation rules - El Forum - 01-12-2008

[eluser]CI jforth[/eluser]
Just ran in to this don't know if it's a bug or not but if you have spaces between rules they get ignored.

$rules['password'] = "required|matches[password_confirm]";

$rules['password'] = "required | matches[password_confirm]";

trim validation rules - El Forum - 01-13-2008

I'm not sure if you can call this a bug. The rules string is documented without spaces which saves a trim function. I think it's a design choice the CI developers made to optimize the run method. The rules aren't checked in the set_rules method because of the callback functionality.

Maybe the divider could be configurable but i don't know if a lot of developers will change the default because the pipes character is a common divider.

trim validation rules - El Forum - 01-13-2008

[eluser]Michael Wales[/eluser]
I completely agree. Adding in trim() to each of the pipe-delimited strings is just added overhead. I see no reason why someone would be forced to not use the pipe-delimiters.