Apologies typo in title should read dropdown
I am trying to: enter the relationship of one CPT with another on a content creation form
I expected to see: a searchable box
Instead, I got: a dropdown where the only option is "-----Not set-----"
This,affects some but not all of my forms.
Hi Nick,
Thank you for contacting us and I'll be happy to assist.
The list of custom post types in the relationship fields can be empty in a case when there aren't any posts which are eligible to be linked to the new content being created.
Have you checked the source CPT if such posts exist and they're still not showing in the form?
In case the issue still persists, you're welcome to share temporary admin access details, along with the information about the form with this issue.
I've set your next reply as private and please make a complete backup copy of the website, before sharing the access information.
regards,
Waqar
Thanks. I have worked out what the problem is, and I would say this is a "bug".
The relationship slug in this case was set (probably by me) as supporter-campaign. It looks like hyphen is not an allowed character. When I changed the slug to supporter_campaign and recreated the form with this slug to show the field, it was fine.
Use of hyphen in slugs probably ought to be caught at the input stage and rejected
Hi Nick,
Thanks for sharing the update.
By default, the relationship slug uses the hyphen ( - ) to connect the names of the connected posts and I couldn't reproduce this issue on my test website.
( screenshot: hidden link )
If you could share more specific steps and/or screenshot on how to reproduce this, I'll be in a better position to test and report it, accordingly.
regards,
Waqar
Hi Waqar
Thanks
It seems that all of the migrated post relationships on my site use underscore and all new ones since migration use hyphens. The others using hyphens all work, but not supporter-campaign, until I changed the slug to supporter_campaign and changed the references in forms and view.
Maybe something in the editing of the relationship fixed something else and it is unrelated to the use of underscore itself?
Regardless of what I used, the relationship worked fine in the backend but not in Toolset Forms
I believe my issue is now resolved but I worry about the next relationship I create!
Here is a screenshot of my relationships
UPDATE - This also affects another relationship (supporter-show) which I have had to rename to supporter_show
Hi Nick,
Thanks for writing back.
The migrated relationships used underscore to form a slug, so this explains the difference in the slug structure.
( ref: https://toolset.com/2018/05/when-if-to-migrate-relationships-in-old-toolset-sites/ )
To make sure that any newly formed relationships are not affected, you can create two temporary/dummy post types and connect them using a new relationship.
After that, you can test if the slug for this new post-relationship works as expected, in the admin area, views, and forms, etc.
Please let me know if you still find something out-of-place.
regards,
Waqar