Navigation überspringen

[Gelöst] I have one things left to do: combine my forms

This support ticket is created vor 4 Jahren, 5 Monaten. 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Dieses Thema enthält 4 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von larryL vor 4 Jahren, 5 Monaten.

Assistiert von: Luo Yang.

Author
Artikel
#1708287

Ok THANKS Luo! This was fantastic and I appreciate your patience working with me through this.

I have one things left to do: combine my forms: right now I have two forms (1 that adds a new vehicle into the 'vehicle' CPT, and another that adds a new vehicle into the 'vehicle movements' cpt).

What I really want to be able to do, if possible, is present one form (at least from the user's perspective where they enter the VIN. If it already exists then the form pre-populates and they can only create a new 'vehicle movement' cpt (with some fields editable), if the VIN does not exist then they add a new vehicle in 'vehicle' cpt.

Is this possible? If it's not, is there a way to get close to what I want to do?

#1708421

Hello,

There ins't such kind of built-in feature within Toolset Forms, one post form can handle only one post.
In your case, you can try this:

In single "vehicle" post, create a post view:
- Query "vehicle movement" posts
- Filter by:
Post author is same as logged in user
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/
Post type relationship between "vehicle" and "vehicle movement"
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
- In view's loop, display "vehicle movement" post information
If there isn't any post found, display the post form for creating new "vehicle movement" post
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

So user can create only one child "vehicle movement" post for each "vehicle"

#1709027

Well, it wouldn't matter who the original post author is. The only 'key' that we care about searching for in the form (at the moment) is the VIN. So which feature(s) are supported and whcih are not?

1 - autocomplete in a search field?
2 - prepopulating fields after finding the VIN?

Going back to the original ticket (and why I wanted to keep this in one since it's all related) it might not make sense to have multiple CPTs anyway.

#1709455

As I mentioned above, there isn't such kind of built-in feature within Toolset Forms plugin, you can create a post view to search "vehicle" by VIN field value, then display the creating child "vehicle movement" post form.

More help:
https://toolset.com/course-lesson/creating-a-custom-search/
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

#1715169

My issue is resolved now. Thank you!