notEmpty validation. Real notEmpty?

gdejesus

New Member
Hello,
There is a bug in notEmpty validation! If you set your field to be validated by notEmpty your field gets validated even if you enter BLANK SPACES!
I made a little mod to fix it

notEmpty.php

/**
* Validate the elements data against the rule
*
* @param string $data To check
* @param int $repeatCounter Repeat group counter
*
* @return bool true if validation passes, false if fails
*/
public function validate($data, $repeatCounter)
{
if (method_exists($this->elementModel, 'dataConsideredEmptyForValidation'))
{
$ok = $this->elementModel->dataConsideredEmptyForValidation($data, $repeatCounter);
$emp = empty($data);
$cf = trim($data);
$emp = empty($cf);
}
else
{
$ok = $this->elementModel->dataConsideredEmpty($data, $repeatCounter);
$cf = trim($data);
$emp = empty($cf);
}
if((!$emp) && (!$ok)):
return !$ok;
endif;
}

Perhaps it is useful for someone.
Bye
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top