[Resuelto] Cred_form_validate not firing on edit form
This support ticket is created hace 6 años, 2 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I am trying to: I have some validating to do with some custom coding and I am using this hook to check one of the fields against something before submission.
Link to a page where the issue can be seen: Local Development, including duplicator package.
I expected to see:
The hook firing upon edit form submission
Any edit of the moldflow submission forms were not firing the cred_form_validate hook. The one I was specifically playing with was cred form validate test 2. From the my account page is a link to view submissions. Then the links and edit links are there.
I set it up on a staging enviroment. In order to even see the post links and edit links you will need to login with credentials on the live staging site.
From what I see the hook isn't targetting a specific form.
Could you add an if statement so that its for a specific form like our example here ?
add_filter('cred_form_ajax_upload_validate','my_validation',10,2);
function my_validation($error_fields, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$error_fields;
//validate if specific form
if ($form_data['id']==62)
{
//check if featured image exists o
if ($fields['_featured_image']['field_data']['size'] > 1000000)
{
//set error message for featured image
$errors['_featured_image'] = 'Wrong size image';
}
}
//return result
return array($fields,$errors);
}