I was wondering if it were possible to change the size of the text entry box for short answer questions in a quiz? I managed to achieve this (with a great deal of help!) for the short answer in the lesson but things seem a little different with the quiz module. Any help would be much appreciated.
Best regards,
James Phillips
Hi James,
- Which Moodle version are you using?
- Where would you like to change the size of the input box for short answer questions in the quiz?
- In teacher edit mode (it is now approx. 20 chars long)
- or in student answer mode (it is not approx. 60 chars long)
- or both? What lengths would you like?
- In teacher edit mode (it is now approx. 20 chars long)
Joseph
Sorry for troubling you yet again!
A two line box 60 characters long in student answer mode and teacher edit mode would be great! I am using moodle 1.8.2 and intend to not upgrade for as long as humanly possible.
Best regards,
James Phillips
Hi James,
Because of the different answer analysis system for the short answer question in the Lesson and in the Quiz modules, it is not possible to provide for a 2-line answer box. You can only customize the length of the answer box by doing the following. For Moodle 1.8.2.
Go to file edit_shortanswer_form.php. About line 31 replace:
$repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'));
with
$repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'),array('size'=>67));
This will give you a box for approx. 60 characters (this may vary a little according to your current theme and current browser text size, etc.)
By default, i.e. if no value is given, that input box is 20 characters long. I also find it ridiculously short.
Curiously, In student answer mode, the input box provided is already set to size = 80.
Tim, if you're listening, why not make things more consistent and have the answer inputbox in teacher edit mode 80 characters long too? I thought I'd asked for this some time ago already.
Hope that helps,
Joseph
that is very unfortunate. I would need a multiple line short-answer textbox as well. Is there still no solution to this? Where and how is the input type for short-answer questions set?
I am using Version 1.9.3.
Thanks for any hints...
Cheers
Bernd
It's often possible to rethink a question if one knows what it is about.
BTW the tracker issue is already marked resolved! (So I was too late to vote! Isn't this some kind of fast resolution record. Certainly a sterling example!)
Hi Jeff,
there are two aspects:
Layout:
Thematically, our questions of interest are in fact essay questions, i.e. students should write up to 500 characters usually. Therefore a single line input field is a bit small. But, on the other hand, the standard textbox of the essay question is simply to large. Fewer lines and a smaller width would be great.
Autocorrection:
We would like to use the autocorrection functionality of the short answer questions. Namely, grading an answer by letting moodle scan the answer automatically for certain keywords (separated by wildcards, or, ideally by matching regular expressions, but that's another question...). This is not possible with the essay textbox question type.
Thanks a lot for any advice. I am also willing to change some code (I am pretty good with php) but I need some guidance were to start.
Bernd
It will be easy to set the text size whitout any side effects to other question types like numerical.
Pierre
In spite of Pierre Pichet's suggestion to use my REGEXP question type, I'm afraid that what you want to achieve is not realistic. The REGEXP question type does use regular expressions to scan SHORT students responses for a) the presence of correct words or groups of words and b) the absence of obligatory words. It will certainly not work on text chunks of 500 words!
You can try it out, but don't set your expectations too high.
Joseph
There are some features (like showing the teacher which possible answers a certain expression could give) that probably have to be turned off. Regular expressions is a wonderful tool for teachers that want to give feedback.
Do keep us posted on how it goes! (I'M HOPING )
However, I am still not satisfied (sorry!!!):
@Joseph:
Unfortunately, I can't get the regex question type to work. Whenever I am trying to save the question, I get an "Error: Missing question options! Could not insert quiz regexp options!". I am using Moodle version 1.9.3 (Build: 20081015). All I did, was downloading the regexp questiontype from moodle.org/mod/data/view.php?d=13&rid=338 ("for Moodle 1.9") and extract it to <root>\question\type. I also went to the Frontpage, logged in as admin, as proposed at http://moodle.org/mod/forum/discuss.php?d=38542#p367897 What have I done wrong?
I also tried using the "latest version" of the regexp question type, but then, all I get after saving, is a blank white page.
@Pierre:
What do you mean by "It will be easy to set the text size...". First of all, where do I do this and secondly, that doesn't solve my problem, does it? Altering the text size, will not result in a two- or multiple-lines textbox!? It will still be a single line input field with small letters.
Thanks a lot for any further advice!
Bernd
Hi Bernd,
the following is just a hint, not yet a solution.
Changing the text input tag in moodle\question\type\shortanswer\display.html from
<div class="answer">
<input type="text" class="<?php echo $class; ?>"
<?php echo "$readonly $inputname $value"; ?> size="80"/>
<?php echo $feedbackimg; ?>
</div>
to a textarea tag like so:
<div class="answer">
<textarea rows= "3" cols ="80" class="<?php echo $class; ?>" >
<?php echo "$readonly $inputname $value"; ?>
</textarea>
<?php echo $feedbackimg; ?>
</div>
will give you the larger entry field. But I suppose it breaks the code for calling the answer from the database because of the changed tags.
hth Frank
I've just found out as well. Display.html was exactly what I was looking for. So far, it seems to work perfectly: However, as you said, you have to split up the parameters readonly, inputname and value appropriately. I.e. replace line 15 in \question\type\shortanswer\display.html
<input type="text" class="<?php echo $class; ?>" <?php echo "$readonly $inputname $value"; ?> size="80"/>
with:
<textarea <?php echo "$readonly $inputname"; ?> class="<?php echo $class; ?>" cols="50" rows="5">
<?php echo substr($value, 8, (strlen($value)-10)); ?>
</textarea>
Thanks again to everyone!
C:\XAMPPlite\server\moodle\question\type\shortanswer\display.html
I open the display.html file and replace the code like what u did and save the file, but i am unable to get it even when i refresh the moodle page or restarting the whole moodle server.
Oops, there is a mistake in the textarea HTML. One angel bracket is misplaced. The code should look like this.
<div class="answer">
<textarea rows= "3" cols ="80" class="<?php echo $class; ?>"
<?php echo "$readonly $inputname $value"; ?> >
</textarea>
<?php echo $feedbackimg; ?>
</div>
That seems to do the trick with my development installation but I only did some quick testing.
Kind regards, Frank
<textarea rows="1" cols="30" class="glyph" readonly="readonly" name="resp402_" value="sḫtἰw"> </textarea>
Oddly enough, I used similar code in 1.6.5 and did not have this problem. Anyone know a solution for it
My reason for using the textarea at all was because students need to enter letters with diacritics on the bottom and the regular input field on a Mac was cutting those diacritics. I wonder if there is any other workaround for this instead of the textarea one.
<textarea rows="1" cols="30" class="glyph" readonly="readonly" name="resp402_"> sḫtἰw </textarea>
Preg question type support any regular expressions that PHP preg_match function could handle. That is much more that regex question type allows.
Hi
Can anyone also help on muliple choice answer field. I have some script codes as answers, so want to modify the answer field as multi line text area.
Thanks,
Abbas