Development:Calculated question js validating forms
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 in
\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 ( edit-questiontext._textArea==)
does not work.However
if ( edit_questiontext._textArea==)
access the right value either in Explore, Netscape or Firefox browsers.
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.