Skip Navigation

Validation of form fields for selecting related posts cannot be validated

Open

Reported for: Toolset Forms 2.2.1

Topic Tags: CRED API, Toolset Forms

Symptoms

When you have a Post Form which allows adding related posts in a one-to-one or one-to-many relationship, the validation of the field for selecting a related post is not working.

This happens because the cred_form_validation hook that is required for validation to work will feature an empty value for that form field. This makes validation impossible.

Workaround

The current workaround is to validate the field with data in the superglobal $_POST and not thru the $fields variable that Toolset Forms plugin provides in the cred_form_validate hook.

The following is an example of such field in the $_POST if you have a one-to-many relationship between Pages and Posts:
$_POST['@page-post-many_parent']

This will return the value of the field and can, therefore, be validated.

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>