Hello. Thank you for contacting the Toolset support.
Can you please share more details about your problem what exactly you are looking for.
Do you mean you have post form where you have a generic select field added and with this field you want to display the parent posts that belong to the current post where this form is added?
I have a child post type called communication. This child post type has a parent post type called rental. Where rental has a parent called tenant. For tenant I have child post type called contact.
So, what I have now is when I create new communication it will be a child for a specific rental.
Now I want also to have a field in the communication form where I can select which contact of the tenant that communication should be linked with (that is why I am using generic field with view of contacts for current tenant). So, At the end after submitting the form I want to know this communication is for which rental and which contact.
Basically, when you submit the form, you are connecting communication with the rental. Now there is no relationship between contact and communication. so without the relationship, we can not connect the posts.
Normally, Toolset offers post-relationship API and you can use the function toolset_connect_post() that you can use with the Forms API hook cred_save_data:
For example:
add_action('cred_save_data','func_connect_contact',10,2);
function func_connect_contact($post_id,$form_data) {
if ($form_data['id']==9999) {
// your code goes here
}
}
I do have relationship between contact and communication. However, I don't know how to link the communication post to be child of rental and contact when submitting the form. For now I can link it only with rental.
Ok - I would like to know where exactly you have added the form? is form added on the single post of the parent (rental)? Does your form have the parent selector?
If you can share problem URL and access details I can review it quickly and guide you accordingly.
I have set the next reply to private which means only you and I have access to it.
Ok - there is no native way to filter the relationship select boxes. However - I would still like to know from where you want to get the information that you want to load these specific tenant's related posts?
Do you mean as the form is added on rental post based on rental post ID get the related specific tenant and load all the contacts belongs to this specific tenant?
"Do you mean as the form is added on rental post based on rental post ID get the related specific tenant and load all the contacts belongs to this specific tenant?"
So, as I acknowledged that there is no native way to do it but I can share the workaround if that helps otherwise there is no way.
But I need access details to check the fields and relationships. Can you please share the problem URL and access details.
I have set the next reply to private which means only you and I have access to it.
I'm checking the Layout for rentals you added:
=> versteckter Link
And now, on single rental page where the contact tab is added, I do not see anything and when I checked the Layout, from the contact tab there is nothing added. Are you working on the site and changed anything? Can you please share where I can see the Form now?
Ok - with FTP, I was able to debug this further and now the core codebase has been changed for the forms and there is no way to filter the parent select2 options as there is no filter available to filter the results.