Validate Gravity Form Hook

<?php
//Validate After Hours
function ps_custom_validation($validation_result){
$form = $validation_result['form'];
if(ucfirst($_POST['input_6']) != 'Kimberly'){
$validation_result['is_valid'] = false;
foreach($form['fields'] as &$field){
if($field['id'] == '6'){
$field['failed_validation'] = true;
$field['validation_message'] = 'The name entered is not valid.';
break;
}
}
}
$validation_result['form'] = $form;
return $validation_result;
}
add_filter('gform_validation_2','ps_custom_validation');
?>

0 Comments

You must be logged in to post a comment.