I have a form that will eventually be a user registration form that has a custom validation check for a registration code held in the database, but I can't even get the most basic validation check to work. I think must be doing something really simple wrong but I can't tell. I'm using the exact same code in the documentation for get_field_validation, but with my own form and field ID.
add_filter("gform_field_validation_1_4", "custom_validation", 10, 4);
function custom_validation($result, $value, $form, $field){
if($result["is_valid"] && intval($value) > 10){
$result["is_valid"] = false;
$result["message"] = "Please enter a value less than 10";
}
return $result;
}
All I wanted to do was make sure I could have custom validation work but not even this works, the form submits successfully no matter what. Does the validation only work on certain field types? I'm using a Single Line Text field. The test form is currently at http://qrkeycard.com/?page_id=5 if you want to see it or try it for yourself.
Hopefully this is just a facepalm moment and I can feel dumb and then we can laugh and move on.
Thanks!