CodeIgniter Forums
Codeigniter 3.1.10 Trim Rule - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Codeigniter 3.1.10 Trim Rule (/showthread.php?tid=74285)



Codeigniter 3.1.10 Trim Rule - ChicagoPhil - 09-05-2019

The form validation rule "trim" seems to be missing from the library. when using this rule I noticed a line in my log file that reads "Unable to find validation rules".

In the user guide it still refers to the rule in the "alpha_numeric_spaces" rule:

Returns FALSE if the form element contains anything other than alpha-numeric characters or spaces. Should be used after trim to avoid spaces at the beginning or end.

is Trim no longer a useful rule?

I apologize if I missed something here.


RE: Codeigniter 3.1.10 Trim Rule - dave friend - 09-06-2019

The "trim rule" is quite literally the native PHP function trim and so is not in Form_validation.php. The documentation says that any native PHP function that accepts one parameter can be used as a rule.


RE: Codeigniter 3.1.10 Trim Rule - ChicagoPhil - 09-06-2019

Ok, I just wanted to make sure I wasn't writing in trim all over the place and have it doing nothing. I'll have to dig into the log files more to see what's throwing that error.


RE: Codeigniter 3.1.10 Trim Rule - dave friend - 09-06-2019

The error is logged in validation->run() and is quite literal. It cannot find any associated rules in any of the places it expects to find them.

How are you setting rules and where?


RE: Codeigniter 3.1.10 Trim Rule - ChicagoPhil - 09-06-2019

(09-06-2019, 03:56 AM)daveĀ friend Wrote: The error is logged in validation->run() and is quite literal. It cannot find any associated rules in any of the places it expects to find them.

How are you setting rules and where?

The rules are all set in the form_validation config as an array of arrays. I'm away from my computer at the moment so my answer is from memory.