Home › Forums › Quform WordPress › Quiz stopped working after moving to Quform2
This topic is: not resolved
- This topic has 1 reply, 2 voices, and was last updated 5 years, 9 months ago by Ally.
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- June 10, 2018 at 4:37 pm #26009airweb7Participant
Hello
Please find below the code i used :
function my_score_counter($form) { $score_a = 0; $score_b = 0; $score_c = 0; switch ($form->getValue('iphorm_1_1')) { case 'a': $score_a++; break; case 'b': $score_b++; break; case 'c': $score_c++; break; } switch ($form->getValue('iphorm_1_2')) { case 'a': $score_a++; break; case 'b': $score_b++; break; case 'c': $score_c++; break; } switch ($form->getValue('iphorm_1_3')) { case 'a': $score_a++; break; case 'b': $score_b++; break; case 'c': $score_c++; break; } switch ($form->getValue('iphorm_1_4')) { case 'a': $score_a++; break; case 'b': $score_b++; break; case 'c': $score_c++; break; } switch ($form->getValue('iphorm_1_5')) { case 'a': $score_a++; break; case 'b': $score_b++; break; case 'c': $score_c++; break; } $form->setValue('iphorm_1_6', $score_a); $form->setValue('iphorm_1_7', $score_b); $form->setValue('iphorm_1_8', $score_c); } add_action('iphorm_pre_validate_1', 'my_score_counter');
and
function my_custom_success_message($message, $form) { $score_a = $form->getValue('iphorm_1_6'); $score_b = $form->getValue('iphorm_1_7'); $score_c = $form->getValue('iphorm_1_8'); if ($score_a >= '3') { /* Reponse A max */ $message = "message ..."; return $message; exit; } if ($score_b >= '3') { /* Reponse B max */ $message = "message ..."; return $message; exit; } if ($score_c >= '3') { /* Reponse C max */ $message = "message ..."; return $message; exit; } if ($score_a == $score_b) { /* Reponse A = B */ $message = "message ..."; } elseif ($score_a == $score_c) { /* Reponse A = C */ $message = "message ..."; } else { /* Reponse B = C */ $message = "message...."; } return $message; } add_filter('iphorm_success_message_1', 'my_custom_success_message', 10, 2);
How can I adpat to the new Quform version ?
Thank you
- This topic was modified 5 years, 9 months ago by Ally. Reason: Fixed code formatting
June 12, 2018 at 3:22 pm #26035AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.