Hey Guys,
Ok so this issue would be a bit more on the advanced side I think...
Ok so i have 2 post types i.e. Test Templates & Tests Taken
I want users to setup tests in test templates, which has a title field, and then a repeatable group with text boxes in it... Then I want users to be able to take the tests and it to save in another post type which will be pulling data from the first.
So for example, if I have a test template with 4 repeated text boxes, it needs to create a field in the second post type, which has the template title as the question for example, and the repeated text boxes as multiple choice answers in a radio button
How can this be done?
Basically i need a dynamic form to the fullest
Hi Marcel,
Thanks for asking! I'd be happy to help.
Your understanding is correct and this will require custom programming.
To insert/save a new post type, when a form for the first one is submitted, you can hook your custom function to "cred_save_data":
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
When your custom function will be executed after the form's submission, you'll have the ID of the newly inserted post, as shown in the example snippets in the documentation.
You can use that ID to get information like title or custom fields data and insert/publish a new post using WordPress' "wp_insert_post" function:
https://developer.wordpress.org/reference/functions/wp_insert_post/
I hope this helps and for more personalized assistance around custom code, you can hire a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar