Format check initialization fail

Re: Format check initialization fail

by Dominique Bauer -
Number of replies: 1
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

On another note, I also have this error in Chrome but I can not complain too much because, for me, it's almost better if this routine is not working, although the red error triangle at the bottom right of the screen is a bit distracting.

In my use of the Formulas question, all the answers are either a number or a number and a unit. If {_0} and {_0}{_u} are used, the width of the input box indicates whether students must enter a number or a number and a unit. If {_0} and {_0} {_u} (separated by a space) are used, the fact that there are either one or two input boxes indicates even more clearly what students should enter. Hence the routine's recall of what should be entered is somewhat superfluous.

The syntax checking, for example for an input of 10e3 mm^2, also seems a bit superfluous, since in any case students have to be reminded of the syntax rules. Also since the verification is done as the answer is input, it may indicate an error while the input is not complete, for example when it is at 10e3 mm^. See the first screenshot below.

So assuming that the routine is not absolutely necessary, another advantage is to gain some space. Since my sub-questions are generally arranged one above the other in a table, I have to provide space between each sub-question when the routine is active, so that the message of a sub-question does not cover the input box of the next sub-question. The Enter key does not release from an input box and it is only natural to click the next box below to enter the next response, which is impossible if this box is hidden. With the routine inactive, the sub-questions can be moved closer together and the answer pages becomes shorter, reducing scrolling. The screenshots below illustrate the above points.

Thanks to Bernat Martinez for bringing this point up and to Renaat Debleu for showing how to disable the routine if wanted.

In reply to Dominique Bauer

Re: Format check initialization fail

by Jean-Michel Védrine -

Dominique,

You can customize the display of the error checking to suit your needs by editing some lines at the beginning of the formatcheck.js file

And fortunately these lines are well commented so it's easy to see what they do:

    var use_format_check = true;    // If it is set to false, no format check will be used and initialized.
    var show_hinting_type = null;   // Show the type hinting under the input box, such as 'Number', 'Unit'. null means use the individual setting in variable types below.
    var show_interpretation = null;   // Show the interpretation of the formula under the input box. null means use the individual setting in variable types below.
    var show_warning = null;   // Show the warning sign if the input is wrong/not interpretable. null means use the individual setting in variable types below.
    var unittest_fail_show_icon = true; // Show an icon at the low right corner if the format check testing fails
    var unittest_fail_show_details = false;  // Show the detail test case that it fails.

In your case you can set both  show_hinting_type and show_interpretation to false.

Hon Wai Lau's code even permit to set some of these flags to true or false only for numbers or for algebraic formulas for instance, see the lines 

var types = [
        ['unit', true, true, true],                 // For the unit input box.
        ['number', true, true, true],               // For the number input box.
        ['number_unit', true, true, true],          // Input box with number and unit together.
        ['numeric', true, true, true],              // Allow the combination of numbers and operators + - * / ^ ( ).
        ['numeric_unit', true, true, true],         // Input box with numeric and unit together.
        ['numerical_formula', true, true, true],    // Allow the combination of numbers, operators and functions.
        ['numerical_formula_unit', true, true, true],   // Input box with numerical formula and unit together.
        ['algebraic_formula', true, true, true],    // Allow the combination of numbers, operators, functions and variables.
        ['editing_unit', false, true, true]         // Used for the unit in editing interface.
    ];