I am trying to:
display the selected relationship from a combo box. Relationships do not appear as selected
Link to a page where the issue can be seen:
I expected to see:
the post title of the related CPT
Instead, I got:
blank selection.The form submits OK.
I thought it sounds like a CSS issue.
i tried the default WP theme and have the same issue.
i tried changing the background from white.
.toolset_select2-selection--single {
background-color:#000!important;
}
this works but there is still no text visible.
i removed the CSS and the input goes back to the attached image.
when highlighting the combo box in developer mode, i can see that it has the correct data
Hi, where can I see the problem on your site? Please provide a URL in your next reply and I will take a closer look. Thanks!
When I go to that URL there is a JavaScript error thrown by datatables:
Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined
at Ha (jquery.dataTables.min.js:24)
at O (jquery.dataTables.min.js:16)
at HTMLTableRowElement.<anonymous> (jquery.dataTables.min.js:17)
at jquery.js?ver=1.12.4-wp:2
at Function.map (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.map (jquery.js?ver=1.12.4-wp:2)
at na (jquery.dataTables.min.js:16)
at e (jquery.dataTables.min.js:92)
at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:93)
at Function.each (jquery.js?ver=1.12.4-wp:2)
I'm not going to be able to debug with this error present. Can you resolve this error, or point me to a different example that doesn't have any JavaScript errors on the page?
Okay it looks like some custom CSS was added to at least two Post Relationship Forms shown on this page. Here are the two Relationship Forms:
hidden link
hidden link
The added CSS:
.toolset_select2-selection__rendered {
display: none;
}
...and also...
.toolset_select2-selection__rendered {
display: none!important;
}
Since these Relationship Forms are included in the same page as the main post editing Form, this CSS is injected into the same page. We use the select2.js library to show these relationship field inputs in both Forms, so there are several identical CSS classnames in the output generated by the two Forms. The custom CSS code in these Relationship Forms targets one of those reused classnames, so it not only hides the selected field text in the Relationship Form, it also hides the field in the main post editing form. There are at least two instances where you'll need to scope your custom CSS code using different ancestor selectors to limit the application of that code to one specific form. I would add a unique CSS classname to the Post Relationship Form cell in the Edit Contracts Layout, then scope your display:none CSS selectors with those ancestor classnames per cell. Make sense? Let me know if you have questions about that.
Thankyou for pointing me in the right direction.
My issue is resolved now. Thank you!