Skip Navigation

[Resolved] Feature request: add new post option when creating a relationship in Toolset Forms

This support ticket is created 6 years, 2 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 3 voices.

Last updated by Beda 6 years, 2 months ago.

Assisted by: Beda.

Author
Posts
#1122650

I have a CPT called "happenings" (events) which is related to a CPT called "locations". This is for an events listing capability.

Users can enter the details of a happening through Toolset Forms and relate it to a venue ("location"). But if the location doesn't exist yet, there is no way to allow them to add a new location and relate it to the happening. Ideally, they'd enter a search in the relationship dropdown and, if no location matched, be offered an option to create a new one.

#1122652

Laura
Supporter

Languages: English (English )

Hi,

my teammate Beda is handling feature requests. At the moment, he has some days off, but he will be in touch with you as soon as he comes back.

#1125155

The feature request already exists:
https://toolset.com/feature-request/extend-current-post-forms-to-allow-many-to-many-connections/
https://toolset.com/feature-request/?wpv_post_search=Extend+current+Post+Forms&wpv_view_count=686737&wpv-wpcf-plugins=CRED

Note that this will never be possible for not-yet-published posts, as those posts cannot be related yet.
This is the same in the backend, first, you will need to save the current post, so to connect it.

That request I shared requests basically to have the same in the front end as in the backend, by behaviour.

#1125269

Understood. I was thinking the flow could be:

- search
- not found returns a "create new {location}" button
- user directed to create form
- submits location
- user directed back to happening form with new location prefilled

Nick

#1125871

With One to Many relations, you could achieve something similar by using Redirects in the Forms.
That would allow redirecting after creating a new Location, or after creating a new event, or after editing any of those.
Conditions could be applied using Forms conditionals or custom JS that hides/shows other buttons to lead to other forms/pages (which then redirect back to the form), in case the location doesn't yet exist.
https://toolset.com/documentation/user-guides/cred-conditional-display-engine/
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/

In Many To Many Relationships, you will need Relationship Forms, those do not yet apply an API, Notifications or Expirations. Redirects can be used only to keep displaying the same page/form, redirect to a specific page, or back to where the user came from.
Since these forms do not yet apply the API you cannot have "more" on top of that, unfortunately

However, in a Many to Many relations, the process is different than in a One To Many, since you will not connect the post while creating or manipulating it, but you will actually create/manipulate the relationship when connecting posts.

You would profit a lot from the feature proposed above, I think, which would just implement the backend experience to the front end.
Conditionals to hide/show those elements should then be applied with Forms Conditions, but for that, the feature first needs to be implemented.

If you would like assistance with current possibilities outlined above, please open a new ticket so we could take a look about what would be possible (It will require custom JS to hide/show the redirect to a create Location form, likely).

With custom JS we will not be able to help but can give ideas and tips about where to look for solutions and examples.