This is a test site. Any changes will be lost!

Development:Calculated question js validating forms

From MoodleDocs

Using javascript to correct for errors or non valid values in each steps of the creation or editing before going to the next step. This instant feedback will allow to save the data even when creating a calculated because on output from the first step the presence of at least a valid calculated parameter ( dataset ) will have be verified.

Bug in weblib.php

When HTML edit is used, the editor is created through the \lib\weblib.php as a textarea with name = questiontext and id = edit_questiontext. However there is typing error or a bad choice in the id identification

\lib\weblib.php(3271):     $str .= '<textarea id="edit-'. $name .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">'; 
and
\lib\weblib.php(3309):     echo "edit_$name = new HTMLArea('edit-$name');\n";

If the id = 'edit-questiontext' for example, the id is not a valid javascript parameter because of the - and a line code like

if ( document.form.edit-questiontext._textArea==)

does not work.However

if ( document.form.edit_questiontext._textArea==)

access the right value either in Explore, Netscape or Firefox browsers. Although

if (  document.form['edit-questiontext']._textArea==)'

could be used, the id choose is confusing. The two lines should be corrected to

\lib\weblib.php(3271):     $str .= '<textarea id="edit_'. $name .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">'; 
and
\lib\weblib.php(3309):     echo "edit_$name = new HTMLArea('edit_$name');\n";

Doing so the javascript analysis of can proceed.

Nowhere in the Moodle code an edit-??? parameter is found.