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?
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"
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.
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/
My issue is resolved now. Thank you!