Tell us what you are trying to do?
I'm trying to display a set of multiple-choice tests, eacho one with its own submit button. For each test, on submit, I must save the user's answer and give them feedback on whether or not it is correct. The available answers for each test are currently represented as fields of the "question" post type (as opposed to a separate "answer" type), and should be displayed as radio buttons so the user can select only one. There's also a field that stores which answer is correct. The tests must be displayed in sets based on a filter on a many-to-many relationship with another post type.
1. How can I show the answers as group of radio buttons? I tried to import them as radio buttons using tha All Import plugin, but they all just show as "Option title 1", instead of the actual text for each answer.
2. How can I save the answer for each question submitted by each user?
3. How can I give the user feedback whenever they submit their answer?
Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/cred-api/
Is there a similar example that we can see?
hidden link
In Portuguese. Not powered by wordpress, but that's the general idea.
What is the link to your site?
hidden link
Hello,
I assume we are talking about custom radio field created with Toolset Types plugin.
Q1) You can display a post form for editing the "answer" post:
https://toolset.com/course-lesson/front-end-forms-for-editing-content/
So it will display as radio field in front-end, then use JS codes to disable them to users, for example:
jQuery(document).on('cred_form_ready', function(){
jQuery("input:radio").attr('disabled',true);
});
In your case, do not display the "Submit" button in the post form, so users can not submit and edit the "Answer" post
Q2) You can setup a post form for creating new "answer" post, after user submit this form, the new post author is the user who submitted the form.
And you can create a page "My answers", in this page, setup a post view:
- Query "Answer" post
- Filter by post's author is same as logged-in users
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/
- In views loop, display the "answer" post information
Q3) In the editing post form of Q1), you can use [wpv-conditional] shortcode to display different feedback on the field values, see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-conditional
My issue is resolved now. Thank you!