Skip Navigation

[Resolved] Relationship Forms only show One-to-Many relationships, not Many-to-Many relationships

This support ticket is created 3 years, 1 month 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#2000623

Hello Christian,

I'm having an issue with Post Forms. This is not a non-standard use where I'm trying to fill self -join entries but many-to-may type relationships between different custom posts. When I generate the post form the only relationship entries that come up on the form are of one to many type not many-to-many. Can you please direct me!!!

Thank you in advance

#2000779

Hello, if I understand correctly you are trying to create a New Post Form, or an Edit Post Form, and you are attempting to add a post relationship field to the Form to manage post relationships for the post, but many-to-many relationships do not appear in the post relationships field editor. If I understand correctly so far, this is actually the expected behavior. Many-to-many relationships cannot be managed in a Post Form, they must be managed in a separate Relationship Form. The workflow for managing many-to-many relationships is independent of the workflow for creating or editing a post, and cannot be achieved in Post Forms without a significant amount of custom code using the Forms APIs and the Post Relationships APIs.

More details about managing one-to-one or one-to-many relationships in Post Forms:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/

More details about managing many-to-many relationships in Relationship Forms:
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

Let me know if you have questions about these processes.

#2001865
Screenshot_2021-03-26 Relationship Forms Editor ‹ The Borzoï Encyclopedia — WordPress.png
Screenshot_2021-03-26 Edit Post Type ‹ The Borzoï Encyclopedia — WordPress.png

Hello Christian,

Glad you're helping me with this one too.

I went into the Relationship Form Wizard and Created New Relationship Form called it "Connect Dog to Breeder". Selected "Breeders" Relationship from the drop down menue. Selected "Redirect back to the page from which the user came from" and on the next page I had no fields. What am I doing wrong now? I've included two screeshots to show you the relationships alredy set up as well as the page in the Relationship wisard where I get no fields.

Thank you in advance

#2003567

It sounds like the Relationship Form's redirection process is not respecting the previous page's URL parameters. Let's say the process starts when editing a post. The Edit Post Form is shown at a URL like this:
https://yoursite.com/post-type/post-title-slug?content-template-id=123
Instead of 123, your URL includes the numeric ID of the Content Template containing the Edit Post Form.

Then you have a link somewhere in Content Template 123 that directs the User to a post relationship Form. The User clicks the link and the URL becomes something like this:
https://yoursite.com/post-type/post-title-slug?cred_action=assign_new_child&content-template-id=456

The Relationship Form is displayed at this URL. The Form is set to redirect the User to the page the User came from, but after submitting the Relationship Form, the User is redirected back to the original post URL without the original content template ID URL parameter. In other words the User ends up here:
https://yoursite.com/post-type/post-title-slug

...instead of the desired location here, with the Edit Post Form template applied:
https://yoursite.com/post-type/post-title-slug?content-template-id=123

You can see that the content-template-id URL parameter from the page containing the Edit Post Form is not respected in the Relationship Form's redirection destination URL. Therefore the User is redirected to the original post and does not see the Edit Post Form. Is this what you are seeing, or have I misunderstood? If you are seeing something else, please walk me through the process starting from the URL where the Edit Post Form is displayed, up until "on the next page I had no fields". Include the full URL of every step in the process.

If you are seeing the same behavior I described, the simplest solution might be to update the Content Template applied to the post. Add a Forms Edit Post Link in the Content Template, so the User has a way to jump back into the Edit Post Form process after submitting the Relationship Form.

#2004011

Hello Christian,

No tha's not my issue. I haven't even got to the stage of using the form. My issue is that I cannot even generate the form to include in the posing page. The screenshots I sent to you are of the process trying to produce the Relationship Form in the Relationship Form Wizard. I want to Created New Relationship Form but once I select the relationship, which is not self-ajoint as was the issue with my privious issue you helped with, I have no fields to add to the form. That is visable on one of the screenshots. In fact that's the case with all the relatinships I select in the Relationship Form Wizard. None of them give me any fields to add to the form.

PS. I have some extra information. I've rolled back my instillation to 12/03 and I again had fields avaliable in the Relationship Form Wizard, as visable in the screenshot. I then went into the expert mode to view the code and various shot codes. Then I was not able to get back to non-expert mode. It have me a warning but the highlighted expert switch had no effect. So I abandoned the form and went back to the Toolset Dashboard and selected the Relationship Forms. Try to make a new Relationship form and again I had no fields available.

#2004023
Screenshot_2021-03-29 Relationship Forms Editor ‹ The Borzoï Encyclopedia — WordPress.png

PS. I have some extra information. I've rolled back my instillation to 12/03 and I again had fields avaliable in the Relationship Form Wizard, as visable in the screenshot. I then went into the expert mode to view the code and various shot codes. Then I was not able to get back to non-expert mode. It have me a warning but the highlighted expert switch had no effect. So I abandoned the form and went back to the Toolset Dashboard and selected the Relationship Forms. Try to make a new Relationship form and again I had no fields available to add to the Relationship form.

#2004037

PS. I have some extra information. I've rolled back my instillation to 12/03 and I again had fields avaliable in the Relationship Form Wizard, as visable in the screenshot. I then went into the expert mode to view the code and various shot codes. Then I was not able to get back to non-expert mode. It have me a warning but the highlighted expert switch had no effect. So I abandoned the form and went back to the Toolset Dashboard and selected the Relationship Forms. Try to make a new Relationship form and again I had no fields available.

#2004073

PSS I have yet more information. Seems if I go into the Relationship Form Wizard and enter a brand new never used before name for the form I get the fields to add to the form. However, if for some reason I abandon the form and go back to the Relationship Forms in the Toolset menue and start again with the wizard and use the same name as before, even though that was not saved and thus is not visable in the list of forms, then I get no fields to add. Seems Toolset remembers the old forms even if they were not saved and displas no fields. That seems like a bug to me. Is there a way to delete these 'unsaved' forms?

#2004365

Is there a way to delete these 'unsaved' forms?
I'm not able to replicate that in my local site. I've created a few forms using similar names, and have not been able to experience the problem you described where field inputs are not displayed. I've tried deleting fields in the expert builder, abandoning the form, and returning to create a new relationship form, but no luck. I've tried completing the form and then returning to create a new form with the same name, but no luck. I must be missing something, or maybe it's an issue specific to your site? Perhaps something is stored in the browser cache? Can I log in to your site and try to create the Form using the same name again to see the problem?

#2004405

Hi,

I'd be happy to give you acess but I'm not sure how becouse this is a dev site I'm running only on my LAN so no acess from outside. I have alos found that if I abandon a form and then go in and call it by the same name and go to the end, see no fields, and save it. I can then delete it and start again and then I do get the fields. So maybe you are right thee is something being stored in the cache but I'm not sure what.

As I said I'd be happy to let you tinker around wit my site but no idea how.

#2004431

PS clearing site data in the browser does seem to help. I'm using FireFox. Do you know of any weirdness with FireFox?

#2004435

Ok did some more experiments. In FireFox when I pick a relationship and then go to the next stage and have no fields and save the form anyway. If I go in the next time it may or may not have fields. Seems the way to get the fields to appear is to go to the Relationship menue and go into the form again. But in Chrome this isn't happening so there is something weird regarding FireFox.

#2004595

Okay let me run some tests in Firefox and see if I can replicate the problem there, I was using Chrome during testing. I'll give you an update before the end of my shift today.

#2004651

There seem to be at least two issues here:
1. It is not possible to exit "Expert mode" in the Relationship Form editor. Once you switch to Expert mode, the toggle stops working as expected and you cannot revert to drag-and-drop mode. This problem can be replicated in Chrome and Firefox, regardless of the form contents and whether you are using the wizard to create a new form or using the main form editor to edit an existing form. The Post Form editor and User Form editor do not seem to have the same problem, though. I am escalating this issue to my 2nd tier support team for additional investigation, and I'll let you know what I find out.

2. In Firefox, sometimes the Relationship Form editor does not include any fields. This seems to happen when creating a new Relationship Form or editing an existing Form. I have noticed a JavaScript error in the browser console that occurs every time the issue is reproduced:

Uncaught TypeError: self.templates.attributeGroupWrapper is not a function...AssociationFormViewModel.js:745:62

The problem seems to be sporadic for me, and I cannot always get it to show up. Hopefully my 2nd tier support team will be able to figure this one out given that it is not reliably reproduced. I'll escalate and let you know what I find out.

#2004803

Thank you Christian. I thought thee was a bug but in the mean time I seem to be able to use it in Chrome and leaving FireFox alone for now.

I have a question to you though. In the links you intitally sent to me on how to use the relationship forms there is the following phrase: "This way, you can design a complete front-end editing interface, using Toolset Forms. Your interface will include forms for creating “events”, “speakers” and the connection between them."

What I am finding though is that I need to have a Relationship Form made for each relationship. So is it possible to have all these fields from Post Forms and relationship form on the same page with a single submit button or do I need to have links to other forms and submit them individually. If so is there an example in the documentation?

Thank you in advance

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