Project:Validation API
Version:6.x-1.0-rc2
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hello,
I'd appreciate a simple PHP validator example to just make clear what the module expects to see. I am trying to validate against blank field have tried the following guess snippets and none is working:

$value != ''
and
if (!$value) return false;
and
if ($value == '') form_set_error();

Thanks,
KT

Comments

#1

Status:active» fixed

Well, I created a validator like this to check if a field has any value in it:

return !empty($value);

It seemed to work fine. However when you are applying a field that will be validated using that validator, "Allow this field to be empty?" MUST NOT be checked, or else your validator will never fail.

#2

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

nobody click here