Skip Navigation

[Resolved] creating a form to add fields on a CPT

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the customer wanted to know how to create and a post relationship so that users can post questions to her FAQ CPT.

Solution:

To create a post relationship please take a look at the link below
https://toolset.com/documentation/user-guides/creating-post-type-relationships/

This support ticket is created 6 years, 8 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 9 replies, has 2 voices.

Last updated by Shane 6 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#624573

Hi, I have a CPT with custom taxonomies and a group fields.
I would like to create a form with CRED, but I don't want it to be to submit a new item of my CPT but only to add fields on it.
It's basically for a FAQ. I want people to be able to submit questions. And I want the questions to be added automatically as a field. Then the owner of the post will be able to answer it and it will be displayed automatically.
So I don't want a whole page for the form, I want a small form that I can add to my single post page that I've already created with a content template.
Thanks!

#624653

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laura,

Thank you for contacting our support forum.

So to get this properly you want to have FAQ page and for your customers to posts questions on that FAQ page correct?

Please let me know.
Thanks,
Shane

#624729

Hi, not exactly, I don't want a FAQ "page", I want a FAQ inside another page, which is a single post from a CPT created with toolset. I want to add a form in that page so that people ask questions, and then the question becomes a field, and once it's answered, the field appears (both question and answer then), using my content template for that single post.
Thanks.

#624941

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2018-03-14 at 9.09.54 AM.png

Hi Laura,

Ok so I have an idea of what you would like to achieve.

This is going to require a Parent/Child relationship in Types. What you need to do is to go to Types and edit the CPT that you want the question to appear on.

Then if you have a questions CPT then you will set the questions CPT as the child of the CPT that you want the questions to appear on.

Next you will need to create a CRED form for this questions CPT and auto generate the form so that it get the fields for the parent.

Then go the page and add the child form link to that page by clicking the CRED form button. See Screenshot.

This should allow you to start creating the questions for that page. Please let me know if you understand this step and then we can move to displaying the questions and answers.

Thanks,
Shane

#625273

Hi Shane, thanks for the reply. I've done what you said but not sure it's what I want or maybe I misunderstood something.

I've created a CPT called FAQ and set it as child of my original CPT (called brand).
Then I have created the form through CRED for the child (FAQ) and have displayed it on the content template for my single posts of the parent CPT (brand).
But the form includes all the fields of the brand (parent CPT), while I just want people to be able to type a question, so to kind-of add a field to my parent CPT, not to fill-in all the fields as they are already filled in and displayed on the page.
Thanks!

#625447

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laura,

The reason why the FAQ CPT includes the fields is that you may not have restricted the Brand CPT field group to only apply to the Brand CPT.

What you need to do is to edit the field group and set it to only display for the Brand CPT then you can regenerate the form.

All the fields from the Parent should be gone.

Thanks,
Shane

#625542

Thanks, you were right, I actually had never seen this option before.
So it's good so far 🙂

#625772

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laura,

Awesome.

Please let me know how its going so far and if you need any further assistance from me 🙂

Thanks,
Shane

#626964

I Shane, yes I would like the next steps please "then we can move to displaying the questions and answers".
Thanks in advance!

#627104

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2018-03-20 at 1.34.00 PM.png

Hi Laura,

So now that we have to create a view that will list out the children. Then add a query filter to that view for the Post Relationship. See Screenshot.

Then set the filter to "parent is the current page..."

Finally just create your loop output on the view and then add that view to the parent page.

This should allow it to display all the child posts for that current parent.

Please let me know if this goes well.
Thanks,
Shane