Replace drop down menu with radio buttons in cloze question

Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -
Number of replies: 54

In my cloze question type, ({1:MULTICHOICE:No Idea  ~=True  ~False}

)how can I replace the drop down menu with radio buttons?

That is, change

 

to look like this

о No Idea            о True                   о False

(Displayed horizontally)

 

Thanks

 

Tieku

Attachment DropDownMenuCloze.jpg
Average of ratings: -
In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -

Tieku,

As far as I know there is no embedded radio button type question in CLOSE (I’m still on 1.6.3 but I don’t think this has changed). What you can do is add to the question your own radio buttons and set the onBlur event of those radio buttons to copy their value to the Moodle MULTICHOICE field which you can have either visible or hidden. See this post for how it can be done. The example works with SHORTANSWER and if you keep these fields hidden that it might be simpler to construct but you can do that also with the MULTICHOICE in which case you need to manipulate the selectedindex. Also in that example accessing the Moodle field requires to extract its id, but it can be done dynamically by navigating the DOM and you can find an example of that in this post.


Itamar smile


In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Itamar,

I read the post but don't understand what to do. So what would be  the equivalanet for

{1:MULTICHOICE:No Idea ~=True ~%-100%False}

This is how I want the questions diplayed:

Question Here oNo Idea      oTrue     oFalse

Tieku

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
Here is one way to do it:

<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td valign="top">The answer to this question is true</td>
<td valign="top"><input name="yaynay" onclick="this.parentNode.parentNode.childNodes[3].firstChild.selectedIndex=1;" type="radio" />True</td>
<td valign="top"><input name="yaynay" onclick="this.parentNode.parentNode.childNodes[3].firstChild.selectedIndex=2;" type="radio" />False</td>
<td valign="top">{:MULTICHOICE:=True#~False#}</td>
</tr>
</tbody>
</table>

radio-cloze-before

On clicking one of the radio buttons the Moodle MULTICHOICE is set. If you change anything in the table structure you may need to change the DOM path from the radio button to the MULTICHOICE field (that's the onclick command string).

radio-cloze-result.jpg

You can see that the radio button values are not preserved after submission but with a little bit more work they can be restored and then you can hide the MULTICHOICE filed by setting the TD display style to none.

I hope that helps. Let me know if you need more details. smile

Itamar
In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
Here is a simple code for restoring the radio button values after submission:

<script type="text/javascript">
<!--
var sel=document.getElementsByTagName("select");
for (i=0;i<sel.length;i++){
var ind=sel[i].selectedIndex;
if (sel[i].parentNode.parentNode.childNodes[ind].firstChild.type=="radio"){
sel[i].parentNode.parentNode.childNodes[ind].firstChild.checked=true;
}
}
-->
</script>

It should be included once in every quiz page. The DOM path assumes the above table structure so if you change that structure you may need to change the path. Let me know if it works for you. smile

Itamar
In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
By the way, I don't think you need the 'No Idea' as it is the default when none of the radio buttons is checked. Moreover, any reasonable student will prefer choosing either True of False over No Idea even if he or she has no idea simply because 'No Idea' is not really a possible answer to the question. wink
In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

I will take a look at the code and see whether I can get it to work. How come I see the radio buttons and also the drop down?

 

The reason why I need “No Idea” is students are penalized for wrong responses. So a student should have an option not answer if he is not sure, or change answer from True or False. So here is how the points are awarded.

 

No Idea – 0

True +1 or -1

False +1 or -1

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
The drop down has to be there because this is how the quiz marks the question. And you can see it because if it were hidden you wouldn't understand what I'm referring to. But you can easily hide it as I suggested above. smile
In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Hello Itamar,

 

Thanks for the help. I am not a programmer and I am not familiar with PHP coding, but if you let me know where exactly everything should be put, I should be able to do it.

 

Did you understand my explanation for needing radio a button for “No Idea”? I have a separate hack that subtracts a point for incorrect responses (to discourage guessing) so a student who does not want to risk losing a point when they are not sure should have the option of no answering, which is the “No idea” radio button. That is why in Multichoice I have {1:MULTICHOICE:No Idea ~=True ~%-100%False}and

{1:MULTICHOICE:No Idea ~%-100%True ~=False}

 

Please put all the steps in one reply for me (and where exactly they go):

 

  1. Replace drop down with radio buttons

  2. Copy radio buttons values to the Moodle MULTICHOICE field

  3. Hide multichoice drop down

  4. Preserving radio button values after submission

 

 

For example where exactly do I it put the code below:

 

<script type="text/javascript">
<!--
var sel=document.getElementsByTagName("select");
for (i=0;i<sel.length;i++){
var ind=sel[i].selectedIndex;
if (sel[i].parentNode.parentNode.childNodes[ind].firstChild.type=="radio"){
sel[i].parentNode.parentNode.childNodes[ind].firstChild.checked=true;
}
}
-->
</script>

 

Tieku

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
Hi Tieku

  • Create a Cloze question
  • In the question's text editor change to html mode (ed_html.gif)
  • Paste the following html code
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="padding-right: 20px;" valign="top">Enter question description here</td>
<td style="background-color: rgb(221, 221, 221);" valign="top"><input name="YYYY" Xonclick="this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=1;" type="radio" />Not Sure</td>
<td style="background-color: rgb(221, 221, 221);" valign="top"><input name="YYYY" Xonclick="this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=2;" type="radio" />True</td>
<td style="background-color: rgb(221, 221, 221);" valign="top"><input name="YYYY" Xonclick="this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=3;" type="radio" />False</td>
<td style="visibility: hidden;" valign="top">{:MULTICHOICE:Not Sure#~=True#~False#}</td>
</tr>
</tbody>
</table>

  • Remove X
  • replace YYYY with a unique name (must be different for each question if you have more than one question in a page)
  • Set the desired correct answers in the MC fields
  • Enter question description where it says 'Enter question description here'
  • Save
  • Create a Description question
  • In the question's text editor change to html mode (ed_html.gif)
  • Paste the following code
<script type="text/javascript">
<!--
var sel=document.getElementsByTagName("select");
for (i=0;i<sel.length;i++){
var ind=sel[i].selectedIndex;
if (sel[i].parentNode.parentNode.childNodes[ind].firstChild.type=="radio"){
sel[i].parentNode.parentNode.childNodes[ind].firstChild.checked=true;
}
}
-->
</script>
  • save
The description question is invisible from students perspective because it displays nothing. It must be included in each quiz page. If you have more than one page you will need to duplicate the question and give each instance a unique name (this at least is what I have to do in 1.6.3; I don't know if that has changed in subsequent versions).

That's about it. Give it a try and let me know how it works.

Itamar smile

P.S. If I may make a suggestion, 'No Idea' seems to me too strong as I might have an idea but I may not be sure enough to select the answer I think is the correct one. Perhaps 'Not Sure' will do more justice in such cases.
In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Itamar,

Thanks for the step by step instructions. I will let you know how it goes. I like your suggestion for using Not Sure instead of No Idea.

In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Itamar,

I coud not get it to work. Please see attached Word file for screenshots. Here is my code for the cloze question:

<table cellspacing="0" cellpadding="0" border="0"><tbody>
  <tr>
    <td style="padding-right: 20px" valign="top">This is Queston 1
    </td>
    <td style="background-color: rgb(221,221,221)" valign="top"><input onclick="function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=1; } } } } } }" type="radio" name="QUE1" />Not Sure
    </td>
    <td style="background-color: rgb(221,221,221)" valign="top"><input onclick="function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=2; } } } } } }" type="radio" name="QUE1" />True
    </td>
    <td style="background-color: rgb(221,221,221)" valign="top"><input onclick="function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=3; } } } } } }" type="radio" name="QUE1" />False
    </td>
    <td style="visibility: hidden" valign="top">{:MULTICHOICE:Not Sure#~=True#~%-100%False#}
    </td>
  </tr></tbody>
</table>

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
Is function anonymous the hack for wrong answer penalty? Could you first try the code without that function and see if it works? Then tell me what you are trying to do by this function. What seems to be the problem is that by placing the 'this.parent...' inside the function you change the 'this' reference. You can also try adding the function right after the 'this.parent...;' as a second command.


In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

No, I do not use function anonymous for my negative marks hack so I do not know whether it would be interfering with yours.

Here are the 2 files and functions I use:

 

File: moodle\lib\questionlib.php
function question_apply_penalty_and_timelimit(&$question, &$state, $attempt, $cmoptions)
{
    // deal with penalty
    if ($cmoptions->penaltyscheme) {
            $state->grade = $state->raw_grade - $state->sumpenalty;
            $state->sumpenalty += (float) $state->penalty;
    } else {
        $state->grade = $state->raw_grade;
    }

    // deal with timelimit
    if ($cmoptions->timelimit) {

        // We allow for 5% uncertainty in the following test
        if (($state->timestamp - $attempt->timestart) > ($cmoptions->timelimit * 63)) {
            $state->grade = 0;
        }
    }

    // deal with closing time
    if ($cmoptions->timeclose and $state->timestamp > ($cmoptions->timeclose + 60) // allowing 1 minute lateness
             and !$attempt->preview) { // ignore closing time for previews
        $state->grade = 0;
    }

    /* negative marks hack start: commented the line below 
    // Ensure that the grade does not go down
    $state->grade = max($state->grade, $state->last_graded->grade);
    negative marks hack stop */
}


File: moodle\question\type\multichoice\questiontype.php
    function grade_responses(&$question, &$state, $cmoptions) {
        $answers      = $question->options->answers;
        $testedstate = clone($state);
        $teststate    = clone($state);
        $state->raw_grade = 0;
        foreach($answers as $answer) {
            $teststate->responses = array('' => $answer->id);
            if($question->options->single) {
                if($this->compare_responses($question, $testedstate,
                 $teststate)) {
                    $state->raw_grade = $answer->fraction;
                    break;
                }
            } else {
                foreach($state->responses as $response) {
                    $testedstate->responses = array('' => $response);
                    if($this->compare_responses($question, $testedstate,
                     $teststate)) {
                        $state->raw_grade += $answer->fraction;
                         break;
                    }
                }
            }
        }
        if (empty($state->raw_grade)) {
            $state->raw_grade = 0;
        }

        /*  negative marks hack start
        // Make sure we don't assign negative or too high marks
        $state->raw_grade = min(max((float) $state->raw_grade,
                            0.0), 1.0) * $question->maxgrade; */
        $state->raw_grade = min((float) $state->raw_grade, 1.0) * $question->maxgrade;
        // Negative marks hack stop
       
        // Apply the penalty for this attempt
        $state->penalty = $question->penalty * $question->maxgrade;

        // mark the state as graded
        $state->event = ($state->event ==  QUESTION_EVENTCLOSE) ? QUESTION_EVENTCLOSEANDGRADE : QUESTION_EVENTGRADE;

        return true;
    }

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
That's the code you presumably used but the highlighted part (which appears in other lines too) shouldn't be there. (And I trust that you remove the X in the Xonclick too). Without it it should work.

<table cellspacing="0" cellpadding="0" border="0"><tbody>
<tr>
<td style="padding-right: 20px" valign="top">This is Queston 1
</td>
<td style="background-color: rgb(221,221,221)" valign="top"><input Xonclick="
****function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() {
****
this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=1;
**** } } } } } }****
" type="radio" name="QUE1" />Not Sure
</td>
<td style="background-color: rgb(221,221,221)" valign="top"><input Xonclick="function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=2; } } } } } }" type="radio" name="QUE1" />True
</td>
<td style="background-color: rgb(221,221,221)" valign="top"><input Xonclick="function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=3; } } } } } }" type="radio" name="QUE1" />False
</td>
<td style="visibility: hidden" valign="top">{:MULTICHOICE:Not Sure#~=True#~%-100%False#}
</td>
</tr></tbody>
</table>
In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

I tried it again from scratch. I realize that when i paste the code for the cloze question in html mode, make all changes (delete X and replace YYYY etc), close it the question editor, and open it again, the function anonymous appears on its own. Where is this coming from?

Looks like someone had the same problem:

http://moodle.org/mod/forum/discuss.php?d=8927

and why is the X put infront of onclick, only to be removed?

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

This is another question. In the drop down menu for multiple choice in cloze type questions, is there a way of letting the word “Choose…” show the way it does for Matching questions:

 

Multiple choice cloze:

/stroke>/f>/f>/f>/f>/f>/f>/f>/f>/f>/f>/f>/f>/formulas>/path>/lock>/shapetype>/imagedata>/shape>

Matching

/imagedata>/shape>

 

Tieku

In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -
Itamar,

I picked up the following from a help page for Format for a question:

Help on writing html

When writing HTML in Moodle, you are free to use almost any HTML tags you like to produce the effect you want.

Note that scripting (eg Javascript or VB Script) is not allowed, and will be removed automatically.

Your code will normally be printed on the page within a table cell, so:

* there is no need to use any <HEAD> or <BODY> tags
* be careful about unmatched </TABLE> tags that may mess up the display.

Smilies (emoticons) will be converted into their graphical equivalent, and bare URLs will be converted into links.

Is this perhaps why i cant get your javascirpt for the radio buttons to work? i am still trying to get it to work.
In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by walad ubooh -

Dears,

Itamar's  solution (first part of it) worked fine with me. But, the 2nd part which should preserve the radio-buttons state didn't work so the radio state is lost after submitting the answer.
When I place the given javascript in a Description Question and let it run as directed in the solution it gives error. It looks that Description Questions don't accept javascrip ?? or some other unknown problem !

Itamar Tzadok replied to an email for me saying there was more work around for this issue was done outside this discussion and he asked me for the link of this discussion session (which I sent it) but no reply for this problem.

Any help !

Thanks,

In reply to walad ubooh

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
Just to say that in 1.9 you have now the possibility to format the multichoice with radio buttons either horizontally or vertically.
Pierre
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Pierre,

where is the option in multichoice to format with radio buttons horizontally?

Tieku

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
I just realize that the help file has not been put on 1.9 although the code is already there.
See The help file of new Cloze multianswer, your suggestions...
and A more versatile Cloze multianswer question type?

Pierre

In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Pierre,

I have read through this, but has this been actually implemented? I do not see the different display options (vertical, horizontal) when I go to create a multichoice question?

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
Which version of Moodle are you using?

Pierre
P.S. This is available on 1.9.3 although the help file is not changed.
You could see an additional item (layout) when using decode and analyze the question.
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by walad ubooh -

Thanks Piere, thanks Tieku,

I used the Demo site and the Multi-Choice Horizontal works fine as you can see below:1

I used it for images questions as you see.The only problem is the background color. My images are all white and the options (table) background is colored. I want to change the table cells color to be white. The other thing is to remove these small cells that are reserved for the feedback.

Appreciating any help,

In reply to walad ubooh

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
I use the standard way to display multichoice.
Pierre
P.S. "I used the Demo site" which one?
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Demo site - demo.moodle.org

Can i get a screen shot of the page where you specify the option for horizontal display of answer choices, or how to get there? Still can't find it.

Is this possible for cloze or multichoice type questions?

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
See MDL-14763

Here is the new file

Pierre
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Thanks Pierre, looks like this is what i have been looking for. Will give it a try and see.

In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Pierre, so that worked. I have three questions:

  1. When will you update the help file for Adding Embedded Answers (Cloze)?
  2. Can I get rid of the automatic numbering of answer choices in MCH (1, 2, 3…)

Picture1.png

  1. What is the significance of 2 in {2:MCH:
In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
1. This has been CVS yesterday on 1.9 merged and HEAD
2. No. I don't want to get to more options than necessary because the Cloze syntax is already quite complex...
3. 2 is the question grade.

Pierre
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Pierre, you wrote:

2. No. I don't want to get to more options than necessary because the Cloze syntax is already quite complex...

I am not asking for more options. For the sake of someone who does not need the numbering, could you leave this blank, so that those who need numbers type it in, and those wanting to use a another scheme have the flexibility to do so?

 

Thanks for your help.

Tieku

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
Effectively this is a good suggestion. I just eliminate the numbering and the user add what he want.
Pierre
P.S. MDL-14763
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -
So this means you will change it to NO numbering. Thank you very much!
In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
Done
Pierre
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -
Done? I just went to demo.moodle.org to try it out and the numbers are still showing? Or do i download the latest version of moodle Moodle 1.9.3+
Tieku



In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
The CVs are done on HEAD version and 1.9_MERGED.
Each week 1.9MERGED is transfered to the MOODLE_19_WEEKLY
You can go to http://cvs.moodle.org/moodle/
select 1.9Merged and you will access the most recent files.
The current demo is Moodle 1.9.3+ build 20081029 i.e october 29 2008

Pierre


In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Pierre,

See attachment for what a typical cloze question using MCH will look like for me.

  1. Can you replace the rectangle box, or double border (circled purple) that separates the different cloze answers choices (in my case, Not Sure, True, False with a single vertical line?)

  2. Can you eliminate the extra white space after the last option (circled orange)

I am using a table with 3 columns and 5 rows.

Thanks.

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
Could you add a .doc version as I am not Vista updated.
Thanks
Pierre
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -
 

Pierre, I am resending the document:

See attachment for what a typical cloze question using MCH will look like for me.

  1. Can you replace the rectangle box, or double border (circled purple) that separates the different cloze answers choices (in my case, Not Sure, True, False with a single vertical line?)

  2. Can you eliminate the extra white space after the last option (circled orange)

I am using a table with 3 columns and 5 rows.

Thanks.

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by CDA CDA -
I agree with tieku - what can be done to remove the "double border" or replace with a vertical line.
Thanks!
In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
I answer here to the last Tieku post.
Ok to set a clear separation between the answers i.e. putting them in a distinct cell.
Will try to set things so that all the space is used.
Have to test with different settings.

Pierre
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Pierre,

I downloaded 1.9.3+ (Build: 20081119) yesterday with the updated MCH. Looks very good without the auto-numbering. Looking forward to the other changes just mentioned. Thanks.

Tieku

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
Tieky,
You will have to live with the current display as this is the standard handling of multichoice for display the radio button, the different color when grading and giving the reports with the feedback.
I cannot change this and the convention to click to radio at the left of the answer is standard.
However there is no space left at right when testing on the last version.

Pierre

P.S. This has been CVS down to 1.8
In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Pierre,

 

Thank you for your work on the MCH; it works very well. The current display is good and the changes I suggested are minor.

 

I will download tomorrow to see the changes you made to take away the extra space to the right.

 

Thanks.

This has been CVS down to 1.8? What does this mean?

In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Hello Pierre,

I noticed with a recent download of Moodle that the output for the MCH cloze question type is not transparent as it used to be. Can you revert back to using a transparent background so that I can apply background colors to the table cell I put the MCH in?

Tieku

In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Tieku Bortei-Doku -

Hello Pierre,

I noticed with a recent download of Moodle that the output for the MCH cloze question type is not transparent as it used to be. Can you revert back to using a transparent background so that I can apply background colors to the table cell I put the MCH in?

Tieku

In reply to Tieku Bortei-Doku

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
The table is defined as
<table class="answer">
<tr class="<?php echo 'r'.$row = $row ? 0 : 1; ?>">
<?php $row = 1; foreach ($anss as $answer) { ?>
<td class="c0 control">
<?php echo $answer->control; ?>
</td>
<td class="c1 text <?php echo $answer->class ?>">
<label for="<?php echo $answer->id ?>">
<?php echo $answer->text; ?>
<?php echo $answer->feedbackimg; ?>
</label>
</td>
<td class="c0 feedback">
<?php echo $answer->feedback; ?>
</td>
<?php } ?>
</tr>
</table>
So the css classes( i.e. "answer") control the display.
I did not change the multianswer code but the css could have been changed or another theme chosen by your moodle site manager.
Pierre


In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
"there is no embedded radio button type question in CLOSE (I’m still on 1.6.3 but I don’t think this has changed)."

Effectively this has not changed because many people use cloze questions in text so they want the cloze display stay in-line so that it can be used to test puncuation mark for example.
The recent modifications has been to eliminate the space between the text and the input HTML field and to size the input HTML field in relation to answer size like the select element.

The Cloze question code convention cannot be changed and there was no provision for formatting the question.
The usefulness of Cloze question being its simple coding that allow you to create rapidly a complete quiz in a single question if you need it (i.e. at 10 p.m. for a 9.00 am course tomorrow morningsmile

Pierre

P.S.Although your hacks are very clever, they remain hacks.
I think that we could modify the actual Decode and Verify the Question Text in the 1.8 + editing interface to add this layout option that could stored in the question_multichoice table.
However it could be not stored in the actual import-export cloze text format but could be in the backup and restore process.
It wouldl allow the Cloze display to meet some of the accessibility standards.

In reply to Pierre Pichet

Re: Replace drop down menu with radio buttons in cloze question

by Itamar Tzadok -
Thanks Pierre. My hacks are a necessity rather then a choice. I use what I have, but I don't have much, so I have to be creative. wink To put it another way, if I had access to the core code I would definitely do something along the lines of what you mentioned. At any rate the Cloze question apparently exceeded its designers' expectations. For me it's main strength is in its flexibility in laying out structurally complex questions (which otherwise use the standard embedded question types). I posted some images of questions I used. The rest is a bonus. smile
In reply to Itamar Tzadok

Re: Replace drop down menu with radio buttons in cloze question

by Pierre Pichet -
I just add this as an improvment in the tracker MDL-1473.
So you can put your suggestions.

Pierre