What does the trim form validation rule actually do and when should I use it?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It removes whitespace from the beginning and end of an input string.
You can think of validation rules as a pipeline of routines run on the input. For example :
When validating the email input CodeIgniter :
The trim routine is normally run before other routines and placed at the front of the list.
You should use it when you want to ignore the starting and trailing whitespace in the input. Perhaps the user has accidentally typed a space character after an email address in a HTML form. The space character should not be taken as part of the email address and should be removed.