I have a programatically created a consent field, which is marked as required (‘isRequired’ => true). Even though the consent field is checked when submitting the form, the forms is returning an error that the consent field is unchecked.
I believe I’m missing a parameter in the GF_Fields::create, because my other text fields, that were created the same way, work correctly. Does anyone know, what parameters are required for the consent field? Below I’m attaching the code I’m using to create this field. I’m using the gform_form_post_get_meta to create the field.
The field is created correctly, the validation does not work.
$nazev_test = GF_Fields::create( array(
'type' => 'consent',
'id' => 1520, // The Field ID must be unique on the form
'formId' => $form['id'],
'isRequired' => true,
'label' => 'TEST label',
'checkboxLabel' => 'TEST TEXT',
'description' => ' / lorem ipsum',
'pageNumber' => 1, // Ensure this is correct
) );
$form['fields'][] = $nazev_test;
return $form;