Trying to use the hash symbol as part of a cloze question
Number of replies: 5
I am a music professor and want to ask students to identify musical chords with sharps (such as G#) within the multichoice feature of a cloze question. Specifically, I am asking them to name chords of a musical example using standard popular chord nomenclature. So, for example, they must type E/G# to identify a first-inversion E major chord. The problem is that the syntax of the cloze question assumes the hash symbol is part of the cloze syntax. Is there a way around this?
Re: Trying to use the hash symbol as part of a cloze question
Easy, simply "escape" the # sign that is part of a choice, i.e. put a backslash just before it. Here is an example which works (moodle 1.8).
Which one is a first-inversion E major chord {1:MULTICHOICE:A#Feedback for this wrong answer~A/G\##Feedback for the other wrong answer~=E/G\##Feedback for correct answer}. Thank you!
Joseph
PS.- You write "So, for example, they must type E/G# to identify a first-inversion E major chord." Since this is a multichoice question type I expect you meant "... they must select E/G# to identify a first-inversion E major chord."

Re: Trying to use the hash symbol as part of a cloze question
I have tried this and it is not working for me. In order to double check it, I took your exact language and pasted it into my question. The result in my moodle was that the E/G\# showed up exactly like that in the pulldown (i.e. it included the backslash). Is there some hidden character other than the keyboard backslash? I have checked to see what version I am running and my host states that it is Moodle v.1.8.2
Re: Trying to use the hash symbol as part of a cloze question
There is a code difference between 1.8.2 (multianswer/questiontype.php)
// Undo quoting done by the HTML editor.
$wrapped->answer[] = html_entity_decode($altregs[ANSWER_ALTERNATIVE_REGEX_ANSWER], ENT_QUOTES, 'UTF-8');
and 1.8 Head
// Undo quoting done by the HTML editor.
$answer = html_entity_decode($altregs[ANSWER_ALTERNATIVE_REGEX_ANSWER], ENT_QUOTES, 'UTF-8');
$answer = str_replace('\}', '}', $answer);
$wrapped->answer[] = str_replace('\#', '#', $answer);
that explains the difference
So migrate to a newer version.
Pierre
// Undo quoting done by the HTML editor.
$wrapped->answer[] = html_entity_decode($altregs[ANSWER_ALTERNATIVE_REGEX_ANSWER], ENT_QUOTES, 'UTF-8');
and 1.8 Head
// Undo quoting done by the HTML editor.
$answer = html_entity_decode($altregs[ANSWER_ALTERNATIVE_REGEX_ANSWER], ENT_QUOTES, 'UTF-8');
$answer = str_replace('\}', '}', $answer);
$wrapped->answer[] = str_replace('\#', '#', $answer);
that explains the difference
So migrate to a newer version.
Pierre
Re: Trying to use the hash symbol as part of a cloze question
Pierre > There is a code difference between 1.8.2 ... and 1.8 Head
I suppose you mean 1.8.4. HEAD means Moodle 2.0, no?
Joseph
Re: Trying to use the hash symbol as part of a cloze question
Sorry, it was late, I mean Moodle 18_STABLE
Pierre
Pierre