Skip Navigation

[Resolved] I have a cred form and like to have in a select field other CPT title and post i

This thread is resolved. Here is a description of the problem and solution.

Problem:

In a CRED form I have a select field, where I like to have title and post id populated from another CPT we have.

Solution:

You just need to setup a reference field.

Then put above reference field into your post form, it should be able to display as a select field,

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/using-post-reference-fields-to-display-information-from-a-related-post/

This support ticket is created 3 years, 9 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 3 voices.

Last updated by fred-r.M 3 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1613285

Tell us what you are trying to do? In a CRED form I have a select field, where I like to have title and post id populated from another CPT we have.

Is there any documentation that you are following? I did not found a documentation, but found another support post: https://toolset.com/forums/topic/populate-select-field-from-1-or-more-cpts/#post-290750

Is there a similar example that we can see?

hidden link <0 where we have "Tour" to choose - I like to have the populated CPT

<pre>add_filter( 'wpt_field_options', 'fill_select', 10, 3);
function fill_select( $options, $title, $type ) {
if ($title == 'my-custom-select') {
$options = array();
$args = array('hide_empty' => 'false');
$terms = get_posts( array('cycling-tour'), $args );

foreach ($terms as $term) {
$options[] = array(
'#value' => $term->post_id,
'#title' => $term->post_name
);
}
}
}</pre>

What is the link to your site?

hidden link

#1613659

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I checked the problem URL you shared and with the Tour select field, I can see its populating the options. Do you still need help with this? If yes, Can you please tell me what options you would like to see with Tour field and send me access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1614653

Dear Minesh

This population is not dynamic population! I used a normal standard select field!

Regards,

Simon

#1614975

Dear Simon,

Minesh is on vacation.

In your case, I don't think it needs custom codes, you just need to setup a reference field:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/using-post-reference-fields-to-display-information-from-a-related-post/

Then put above reference field into your post form, it should be able to display as a select field, and you can follow below document to display the related "cycling-tour" post information
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent

#1615057

Dear Luo Yang

Great, this worked - I just need to do some design stuff. You might know what I should change.

The field I used now, the select at "Tour (I took part in this tour)" - how can I middle the text and arrow?

Then, this is normal, when I like to redirect after fill out the form, that I get an url parameter like this?

hidden link

The next part I like to do, is to do a view, where I used to have then on each tour, and showing only those related reviews. Do You have a documentation for this? I assume, I can use now this new used field?

Regards

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/i-just-need-to-do-some-design-stuff/

#1616145

I assume the original question of this thread is resolved, according to our support policy, we prefer one question one ticket, for other new questions, please check the new thread here:
https://toolset.com/forums/topic/i-just-need-to-do-some-design-stuff/

#1617625

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.