How do I disable letter labels for Quiz Answers?

How do I disable letter labels for Quiz Answers?

by jeremy kerr -
Number of replies: 15
Hello everyone.

Moodle 1.8.2

We're doing our first pilot course to see the feasibility of using Moodle for a full-scall online LMS.

So far, it's been pretty interesting.

Quick question about creating a multiple choice quiz:

How do i prevent the answers to be labeled with letters (a, b, c ..etc)?

Or is this on because I have the "sort" feature enabled to randomize the questions?

Thanks for your help.

jeremy
Average of ratings: -
In reply to jeremy kerr

Re: How do I disable letter labels for Quiz Answers?

by Mike Allen -

Hi Jeremy,
Its actually very easy. Go to the

moodle/question/type/multichoice/questiontype.php    file

and on lines 319/320 replace: 

 $a->text = '<span class="anun">' . $qnumchar .
                    '<span class="anumsep">.</span></span> ' .
                    format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);

with

$a->text =  '<span class="anumsep"></span></span> ' .
                    format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);


That is remove the '<span class="anun">' . $qnumchar .

Good luck,

Mike

In reply to Mike Allen

Re: How do I disable letter labels for Quiz Answers?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You really ought to remove the corresponding too.

Another way to do this is to add:

.multichoice .anun { display: none; }

To your theme.
In reply to Tim Hunt

Re: How do I disable letter labels for Quiz Answers?

by jeremy kerr -
@ Tim: I tried to modify the config.php file for my theme by adding the line you suggested, and now moodle will not load at all.

I even replaced my backed up version of config file, and I can no longer log in to moodle .. the URL is no longer resolving .. ideas?


@ Mike: i did not see the text in the "questiontype.php" file that you mentioned. I'm on moodle 1.8.2 .. is it possilbe that has changed in this version?


At this point, it looks like I might have to reinstall moodle from scratch .. which i'm not too crazy about, since I've already spent several hours building my quizes and configuring the system .. not to mention adding all my students ..

i appreciate your help ..

how do i get my moodle back on line?

cheers,

-jeremy
In reply to jeremy kerr

Re: How do I disable letter labels for Quiz Answers?

by jeremy kerr -
Update:

@ Tim: I'm back online by removing that line (I thought i had, but obviously not)
So, i've replaced the original config.php, and it's working now ..

i'm obviously not adding the

.multichoice .anun { display: none; }

line correctly ..

i guess i need a bit more hand holding here .. can you please let me know how i should be updating my theme to take this change?

thanks again ..

cheers,

-jeremy
In reply to jeremy kerr

Re: How do I disable letter labels for Quiz Answers?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Jeremy,

You rarely need to modify the config.php in your moodle theme. What Tim meant is: add

.multichoice .anun { display: none; }

to the end of any of your theme's *.css files.approve

Joseph

In reply to Joseph Rézeau

Re: How do I disable letter labels for Quiz Answers?

by jeremy kerr -
Hey Joseph,

thanks for the reply.

I am using the standardwhite template.

I opened the gradients.css file and added that line to the end.

My multiple choice quizes still have a., b., c., etc. prior to every answer.

here's what my gradients.css style sheet looks like. is there a syntax error preventing this from working?:

-------------------
/**
* Adds all the nice finish to the standard theme
*
*/

th.header,
td.header,
h1.header,
h2.header,
h3.header,
div.header {
background-image:url(gradient.jpg);
background-position:top;
background-repeat:repeat-x;
}

.navbar {
background-image:url(gradient.jpg);
background-position:top;
background-repeat:repeat-x;
}

.multichoice .anun { display: none; }
-----------------

thanks,

-jeremy
In reply to jeremy kerr

Re: How do I disable letter labels for Quiz Answers?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Sorry about the misunderstanding. I sometimes forget that there are people in the world can't tell at a glance that a string of random characters is CSS code, rather than PHP, and so belongs in one file, rather than another.

I have just tried the line of code I gave (in Moodle 1.8.2), and it definitely works. I can think of two possible explanations why it is not working for you.

One possibility is that sometimes web browsers cache stylesheets rather than re-fetching them from the web server each time. So you edit the stylesheet, and nothing appears to happen. Normally, you can fix things by holding down CTRL+SHIFT then clicking on the reload button.

The other possibility is that that for some reason, the gradients.css is not actually being used by your theme. If there are other .css files in your theme, try moving the line of code there instead.

In reply to Tim Hunt

Re: How do I disable letter labels for Quiz Answers?

by jeremy kerr -
Hey Tim,

I'm really scratching my head now then.

I tried Ctrl+Shift reload, and I can confirm that updates my themes and styles properly.

And, the gradient.css is being used because it controls the title bar at the top.
It's also the only .css file in there.

I have attached a screen shot of my result.

call me stumped.


cheers,

-jeremy
Attachment quiz.png
In reply to jeremy kerr

Re: How do I disable letter labels for Quiz Answers?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Jeremy,

It does work for me. I have added .multichoice .anun { display: none; } to the end of file moodle/theme/standardwhite/gradients.css. My gradients.css file looks exactly the same as yours. I have refreshed my browser, and the abc letters have disappeared (see attached screenshots). Using Moodle 1.8.2 on Windows XP, Firefox 2 and MSIE 7.

Are you positive that you have not made any customization to the standard or the standardwhite themes? Have you refreshed your browser? Which platform are you using? Which browser? which version? Is this a local site (an Apache server on your computer) or a network or a web provider?

If you put the following line in your moodle/theme/standardwhite/gradients.css file, do you get the background all green?

body {background-color:#00CC00;}

If not, then it means that your moodle course is not reading your gradients.css file for some reason.

Joseph

Attachment image00.jpg
In reply to Joseph Rézeau

Re: How do I disable letter labels for Quiz Answers?

by jeremy kerr -
It appears that the gradient.css is not being read, for some reason.

I will move this question to the themes forum, as my problem seems to be unrelated to the quiz module. Thanks for your time.

-jeremy
In reply to Mike Allen

Re: How do I disable letter labels for Quiz Answers?

by Ali Hastie -

Hi Mike

I ahve also tried removing the lines you mention and I am left with a fullstop beside each answer (as shown within the image). I know it is trivial and probably easy but I am not a PHP Programmer.

Any help much appreciated.

Cheers,

Ali.

Attachment fullstop.jpg
In reply to Ali Hastie

Re: How do I disable letter labels for Quiz Answers?

by Steve Bond -

Hi Ali


To do that you have to remove the separator as well, so remove all of the red code from lines 319/320:

$a->text = '<span class="anun">' . $qnumchar .
'<span class="anumsep">.</span></span> ' .
format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);

so it becomes:

$a->text = format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);

I have a related problem in that questions with more than 26 options start getting prefixed with {, |, } etc. as you go through the ANSI codes. In fact I would consider that a bug - on my way to Tracker now!

Steve

In reply to Steve Bond

Re: How do I disable letter labels for Quiz Answers?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
How on earth can you have MCQ questions with more than 26 options?thoughtful
Joseph
In reply to Joseph Rézeau

Re: How do I disable letter labels for Quiz Answers?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yes, I am inclined to pretend that it is a usability feature that Moodle cannot make a MC question with more than 26 options. Of course, in Moodle 1.9, you can turn of the letters, or use numbers instead, which seems perfectly reasonable to me, so I think I am about to go and wont-fix that bug.
In reply to Steve Bond

Re: How do I disable letter labels for Quiz Answers?

by Ali Hastie -

Hi Steve,

Yup! that worked thanks for that.

Yes!!! > 26 options!? Can I ask why 26 options? Don't your students get frustated with all of these options? I remember being a student myself and getting frustrated with just the questions!!

Thanks again,

Ali.