How to randomize the order of fields? I created a quiz without using quiz mode now I need to randomly order of the questions.

By: Chris Adams | Asked: 06/28/2021
ForumsCategory: Code SnippetsHow to randomize the order of fields? I created a quiz without using quiz mode now I need to randomly order of the questions.
Chris AdamsChris Adams asked 3 years ago
This question was asked recently in the Formidable Slack group. The answer is to use this snippet:
add_filter('frm_get_paged_fields', 'get_extra_form_fields', 10, 3);
function get_extra_form_fields($fields, $form_id, $error = false) {
if ($form_id == 25) { //change 25 to the id of the form to change
shuffle($fields);
}
return $fields;
}
Change 25 to the ID of your form.
Felipe Drago replied 7 months ago

Perfect, it works excellent, but if you want to change the order of the answers?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right