I have front end Post Form with custom Filed Phone, Whatsapp and Email non of them is Required but I want to customer to mention at least one therefor need some of your help
Condition (Required):
Phone or Email or Whatsapp
Is there any documentation that you are following?
Not yet
Is there a similar example that we can see?
I hope you got what I want if still need some help just let me know.
add_filter('cred_form_validate','func_validate_my_form',10,2);
function func_validate_my_form($error_fields, $form_data) {
//field data are field values and errors
list($fields,$errors)=$error_fields;
if ($form_data['id']==99999) {
if (empty($fields['wpcf-phone-number']['value']) and empty($fields['wpcf-whatsapp-link']['value']) and empty($fields['wpcf-e-mail']['value']) ) {
$errors['wpcf-phone-number']='Please enter value for at least Phone,Email, Whatsapp';
}
}
//return result
return array($fields,$errors);
}
Where:
- Replace 99999 with your original form ID
- please replace field slug if required and error message.
If it does not work, please share problem URL where you added your form as well as access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.