aijosh
Member
I'm trying to ensure a minimum number of text users should enter. The validation kept failing even though user passed conditions. So I decided to display the value of strlen and I'm seeing a difference of over 100 characters. strlen is not counting the spaces. I also tried str_word_count() and I get 1 as the word count.
How am I to properly validate this?
$value = $this->data['tablename___textarea'];
$minLength = 400;
if (strlen($value) < $minLength) {
$thisValidation->setMessage($value);
return false; // Validation failed
}
return true; // Validation passed
How am I to properly validate this?
Last edited: