Short Answer text entry box is too long

Short Answer text entry box is too long

by Serhiy Kononenko -
Number of replies: 10

Hi, people. I am using moodle 3.0. I have made a simple quiz (Embedded answers (Cloze) question, short answers) with articles "a" or "an" omitted. In preview it looks OK like this:

line in quiz

But in real view when attempting the quiz I get this same line with entry boxes that are way too long (for an answer consisting of just one or two letters):

too long entry box

How can I get this right? Thank you in advance, I deeply appreciate your help.

Serhiy Kononenko

Average of ratings: -
In reply to Serhiy Kononenko

Ang: Short Answer text entry box is too long

by Bente Olsen -
Picture of Testers Picture of Translators

I have noticed the same issue, and I do not know if there is a fix available. But HotPot might be a better choice for you to these kind of quiz questions.

In reply to Bente Olsen

Re: Ang: Short Answer text entry box is too long

by Serhiy Kononenko -

HI, Bente. I am not very knowledgeable about Moodle and all these code writing things in moodle, yet I have already managed to fix this problem. You need to change the corresponding CSS rule. I need to say I am using the theme Essentials. If you open theme/essential/style/essentials.css and find the selector and rule .formulation input[type="text"], .formulation select {max-width: 100%} and change 100% for 10% then the boxes become short. Or you just leave it as {width: auto}, not max-width. Perhaps there is no such problem in other themes. And I wonder how this change will affect other pages with similar quiz questions. Because I am not an expert, I am not sure my primitive manipulations are appropriate. But I changed {max-width: 100%} for just {width: auto} and that is it. I will see how it works. Best wishes!

In reply to Serhiy Kononenko

Re: Ang: Short Answer text entry box is too long

by Serhiy Kononenko -

PS. HotPot looks a little bit sinister to me smile. I tried it as a SCORM package. Moodle questions are nicer-looking.

In reply to Serhiy Kononenko

Ang: Re: Ang: Short Answer text entry box is too long

by Bente Olsen -
Picture of Testers Picture of Translators

I am pretty sure that it is an issue related to the Essential theme. An easy way to check it is to "Allow theme changes in the URL". As admin go to Site administration ► Appearance ► Themes ► Theme settings

Then you can change your theme to eg. Clean without affecting other users. Add &theme=clean to the URL or ?theme=clean if theres is no '?' in the URL already.

In reply to Serhiy Kononenko

Re: Short Answer text entry box is too long

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

That's odd. My Moodle 3.0.5+, (Build 20160804), behaves correctly in both preview and in a quiz, for both teachers and students.

How old are your questions? The reason I ask, is there was quite a bit of work done on CLOZE for Moodle 3.0 to make shuffle work right. If your questions are from a previous version of Moodle, maybe that could be why you are getting this behavior.

Size of the entry space is mentioned in the documentation, "The size of the entry space or INPUT HTML ELEMENT ( Short and Numerical) will be adjustable to the length of the longest answer (good or bad) + a random number (0 to 15% total length).(Pierre Pichet 15:37, 26 January 2008 (CST))"  Based on this, you certainly should not be getting that big of an entry space.



In reply to AL Rachels

Re: Short Answer text entry box is too long

by Serhiy Kononenko -

I asked the question yesterday (6th of August, 2016). I am surprised myself. And I am at a loss what I did wrong or still it's CSS or something else is wrong, not me. I know the size should be adjustable. My moodle is 3.0.2+ (Build: 20160129). Perhaps I should switch to the version you have 3.0.5+, (Build 20160804) and see what happens. Or it's just because of the theme essentials? Anyway thank you for your feedback. Best wishes!

In reply to Serhiy Kononenko

Re: Short Answer text entry box is too long

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I don't know if it is Essential or something else you may have done. I'm not sure if upgrading to Moodle 3.0.5+ would fix this, but to me it seems to always be best to be on the latest version in a series since it does contain bug and security fixes. I just now added the Essential theme to the site I tested with, switched to the new theme, and It still works as it should giving the same size entry box I had in the previous test.

In reply to AL Rachels

Re: Short Answer text entry box is too long

by Serhiy Kononenko -

Thank you Al for your reply. I tried to install moodle 3.1 but, to the best of my understanding, I was supposed to change something in MSQL, so I got confused and installed 3.0. I changed the CSS rule to get the size right and will see how it behaves with the rest of the questions. Besides, I am learning to use moodle so I will stick with this version for now to get the hang of it all. I will wait for the version 3.2 (or 3.3 smile ) They are improving moodle all the time and I haven't learned yet how to update smoothly. To update often is a little time consuming. Once again thank you! If I have troubles in the future I hope I will be able to find you again to ask for advice. Best wishes!

In reply to AL Rachels

Re: Short Answer text entry box is too long

by François Lizotte -
Picture of Particularly helpful Moodlers
I was also reported that the box was too wide, but it is just like in Al's capture. Could it be narrowed so that it would only take a one digit space?


It is used in a chemistry test where the participants must fill in the blanks in a chemical equation. 

Is there any way to customise the CSS in the theme to make it narrower?

In reply to François Lizotte

Re: Short Answer text entry box is too long

by Serhiy Kononenko -

To answer off-hand, there MUST be a corresponding CSS rule where the length of the box is defined. It depends on the theme you are using though. In Essentials it's in the file theme/essential/style/essentials.css and the selector and rule is .formulation select {max-width: 100%}. 100% must be changed. As I am not knowledgeable about CSS and HTML much, I am not sure what must be assigned instead of 100% to get the box one digit long. Perhaps, just a number 1 will suffice. To find where exactly the CSS rule is you need to go to tools => web developer => inspector and hover the cursor over your answer box. On the right, you will need to find the corresponding selector and rule. I am not sure my explanation will be of much use to you. But you need to find the corresponding selector and rule in CSS -- that is the overall direction you need to move in. Best wishes.