The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Populate select with posts - submission doesn't include select data
Hi all,
I've created a dynamic field that is populated with posts from a custom post type called 'events'. I've got the options value and label showing the post title correctly, and all appears fine.
My problem is when the form is submitted, the chosen post isn't sent in the email notification, but is showing in the entry as selected. I've tried editing the email but the field value just doesn't come through on the email, all other fields are fine.
I've added some screenshots of the field settings, the html output, and the completed entry showing the field entered.
Would appreciate any help to fix this please... have run out of ideas.
Thanks in advance, Dan.
F.Y.I.
To get the field to populate with my post type, I've used this code:
add_filter('frm_setup_new_fields_vars', 'frm_populate_posts', 20, 2); add_filter('frm_setup_edit_fields_vars', 'frm_populate_posts', 20, 2); //use this function on edit too function frm_populate_posts($values, $field){ if ( $field->id == 125 ) { //replace 125 with the ID of the field to populate $today = date('Y-m-d'); $posts = get_posts( array( 'post_type' => 'tribe_events', 'post_status' => array( 'publish', 'private' ), 'posts_per_page' => 30, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( array( 'key' => '_EventStartDate', 'value' => $today, 'compare' => '>=', ) ) ) ); unset( $values[ 'options' ] ); $values[ 'options' ] = array( '' ); //remove this line if you are using a checkbox or radio button field $values[ 'options' ][ '' ] = 'Select event...'; //remove this line if you are using a checkbox or radio button field foreach ( $posts as $p ) { $values[ 'options' ][ $p->post_title ] = $p->post_title; } $values[ 'use_key' ] = false; //this will set the field to save the post ID instead of post title unset( $values[ 'options' ][ 0 ] ); } return $values; }
October 27, 2018 at 7:39 am
One thing I've just noticed further...
When looking at the entries list to like I would to export, and the event data is empty. See the screenshot.
Thanks.
Attachment:
November 6, 2018 at 6:50 am
Can anyone help with this please?
November 27, 2018 at 7:15 am
Does anyone have any ideas how I could resolve this please?
Discussion closed.