Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.6.2
-
MOODLE_26_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MDL-44657-master -
- Download the attached test file test_form_validation and access it
- Make sure that you cannot submit the form if you leave the field "Test" empty (the validation should happen on the client side)
-
BACKEND Sprint 18
Description
The validation script generated by MoodleQuickForm::getValidationScript() uses the form name in the javascript function name. The form name is generated by moodleform::get_form_identifier() as the class name. With namespaced classes the form name may contain backslashes, as in
mod_dataform\pluginbase\entriesform
but javascript doesn't like it and fails.
MoodleQuickForm::getValidationScript() should make sure the form name is javascript valid and escape if needed.
Workaround: Override moodleform::get_form_identifier() in your namespaced form class to return an identifier without the backslashes.