Hello,
I am using Client Script in the Education Module to do the following:
1- Add a custom button to the Quiz creation page.
2- upon clicking the button a dialog with 2 inputs. first is the question category (class) and the second for the number of questions required.
3- when I click submit I need the function to randomly choose the selected number of questions that have the same question category or class selected in the dialog.
the blow code is the dialog code:
frappe.ui.form.on('Quiz', {
refresh: function(frm) {
frm.add_custom_button(__("Get Questions from Bank"), function() {
show_question_dialog(frm);
});
}
});
function show_question_dialog(frm) {
frappe.prompt([
{'fieldname': 'quiz_question', 'fieldtype': 'Link', 'label': 'Question Class', 'reqd': 1, 'options': 'Question Class'} ,
{'fieldname': 'question_count', 'fieldtype': 'Int', 'label': 'Questions Count', 'reqd': 1 }
],
function(questions){
console.log(frm);
getRandomProperty(questions);
},
'Get Questions from Bank',
'Get Questions'
)
}
Any idea how should I start the fetching action and add it to the “Quiz Question” child table.