Modification of questionnaire to sum up certain answers and provide a score

Re: Modification of questionnaire to sum up certain answers and provide a score

by Mari Cruz García -
Number of replies: 0

Yes, something similar to that.

I can see that the easiest way would be to manually create a html page and programme the questions using something like this:

 

fieldset id="question1">
    <legend>What is the answer to this question?</legend>
    <label><input type="radio" name="q1" value="right"> Right answer</label>
    <label><input type="radio" name="q1" value="wrong"> Wrong answer</label>
</fieldset>
<input type="button" id="answer">
<script type="text/javascript">
    document.getElementById("answer").onclick = validate;
    function validate() {
        var radios;
        var i;
        var right;
        radios = document.getElementById("question1").getElementsByTagName("input");
 
        right = false;
        for(i = 0; i < radios.length; i++) {
            if(radios[i].value == "yes" && radios[i].checked == true) {
              right = true;
            }
        }
 
        
</script>

 

However, as we have already created the whole questionnaire using the Moodle questionnaire plug-in, it would be good to keep it in the same format.

We have 2.2 at the moment but we will not upgrade to 2.5 until the next months.

Regards,

Mari Cruz