Add the custom code below according to the documentation:
<?php
add_filter('cred_form_validate','chr_validation',10,2);
function chr_validation($error_fields, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$error_fields;
//uncomment this if you want to print the field values
//print_r($fields);
//validate if specific form
if ($form_data['id'] == FORMID)
{
//check my_field value
if ($fields['generic-field']['value'] != types_render_field("custom-field", array()) )
{
//set error message for my_field
$errors['generic-field'] = 'Please enter a correct PIN.';
}
}
//return result
return array($fields,$errors);
}
Replace FORMID with the ID of your form.
Replace custom-field with the slug of the custom field that you want to check against.
Replace generic-field with the slug of the generic field option you added in the form.