Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

validate

posted by mungiu 8 years ago
$validator->addCallbackRule('name', 'required', 'This field is required.');
function required($value) {echo "-->>";
    return strlen($value) > 1;
}

this validate only when field is fill with something, i need to make this required, any idea?

There is already a fValidation method that does that:

$validator->addRequiredFields('name');
posted by xoan 8 years ago

I know that.

posted by mungiu 8 years ago

Yes, I was having a conversation with someone else this week about fValidation::addCallbackRule(). I think how it works needs to be changed to be useful. It should not be tied to a single field and should have access to the whole validation messages array. Additionally it should always be run, not only if a value exists.

posted by wbond 8 years ago