Skip Navigation

[Resolved] Cred_form_validate not firing on edit form

This support ticket is created 6 years, 2 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Shane 6 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1106814

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

Instead, I got:
nothing

#1106832

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

Thank you for contacting our support forum.

Could you let me know which Form is having the issue with the validation hook so that I can take a look at it ?

Thanks,
Shane

#1106847

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.

#1106851

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

I tried downloading the duplicator package but its not working.

Would you mind providing me with access to the site so that I can have a look ?

Thanks,
Shane

#1106852

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

I was able to get the duplicator to download, however i'm not seeing a Validation hook in the functions.php file of the theme.

Could you let me know where the hook is ?

Thanks,
Shane

#1106898
#1106899

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.

#1106902

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

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);
}

Thanks,
Shane