Issue with caldera_forms_render_get_field_slug
-
Hi,
I am having some issue with the rendered field.
It does show the data but when validating the field it is empty.
It produces an error that it is required even if there is a value selected.This is my code
—–
add_filter(‘caldera_forms_render_get_field_slug-studymode’, ‘cf_get_data_studymode_csu’);
function cf_get_data_studymode_csu($field) {
if (isset($_POST[‘post_id’])) {
$postid = $_POST[‘post_id’];
} elseif (isset($_GET[‘course_id’])) {
$postid = $_GET[‘course_id’];
}$results = wp_get_post_terms($postid, ‘studymode’, array(“fields” => “all”) );
$field[‘config’][‘option’] = array();
foreach ( $results as $key => $data) {
$field[‘config’][‘option’][] = array(
‘value’ => $data->name,
‘label’ => $data->name
);
}// return the field to the form
return $field;
}—–
I can’t figure out the issue. Do you have any idea why it’s not working?
Maybe I have some code issue.Thanks.
- The topic ‘Issue with caldera_forms_render_get_field_slug’ is closed to new replies.