Hey Team,
I want to use survey inputs as custom fields for a CPT. I have created all the remailing fields but I don't have a way to create a Likert style scale using generic fields. I tried to use RFGs but they are not visible on the CPT publishing form. Based on some research on your site, it seems like RFGs have to be entered on a separate form as Toolset treats an RFG as a child post to the CPT. This creates suboptimal user experience as they would need to submit two forms. I want to confirm if this is still true? If yes, what is the most convenient want to add a Likert style survey form with custom fields with rest of the custom fields or without rest of the custom fields?
My exact scenario: I have created a "endorsement" CPT. The person endorsing will give an endorsee a rating for each that needs to be endorsed. So I would need two fields: 1) Skill and, 2) Rating on a 5 point scale.
Skill should be populated from the parent CPT "endorsement request", which is in a O2O relationship with "endorsement" CPT. Basically, I want the endorser to enter rating on a five point scale for each taxonomy term (skill category) associated with the parent post ("endorsement request").
Hi,
Thank you for contacting us and I'd be happy to assist.
Your understanding of the repeating field group fields is correct and they can't be entered in the same form as the parent post type. However, even if this was possible, it won't be useful for your case, since you need the skills to be linked with the parent post's taxonomy terms.
The main challenge is to link the skills in the child form with the terms attached to the parent post, for which there is no built-in way and this will require fairly complex customization.
For example, through a view or custom code, you'll need to first get the ID of the related parent post and then its attached skills taxonomy terms. Once you have them, you'll cycle through each one to generate a generic field in the form for the input of the respective rating.
Here are some of the functions and shortcode that will prove useful:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
https://developer.wordpress.org/reference/functions/get_the_terms/
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_generic_field
For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar
Hi Waqar,
Thanks for sharing the resources. The use of generic fields makes sense but can I create a Likert style scale with generic fields? I want the users to select ratings on a visual scale, not a drop down.
Thanks for writing back.
The generic fields are not limited to select/drop-down type and you can also set them to be a radio button type, which would make the most sense for a Likert style scale.
Once you have the options available as radio buttons, the rest is just the styling which can be controlled through custom CSS code.
My issue is resolved now. Thank you!