Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 3.7.1, 3.8
-
Fix Version/s: 3.7.3
-
Component/s: Forms Library
-
Testing Instructions:
-
Affected Branches:MOODLE_37_STABLE, MOODLE_38_STABLE
-
Fixed Branches:MOODLE_37_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-66106-master -
Pull Master Diff URL:
Description
The ability to randomise element IDs was introduced, as an optional config for forms, in MDL-65217. That issue didn't make all required changes, resulting in JS errors when trying to validate a simple form with randomisation of element ids enabled. The result is that the form posts, when it should not.
I'll include a test script demonstrating the problem, which can also be used for testing the fix.
To replicate the bug:
1. Place 'testform.php' in your webroot and access it
2. Open browser dev tools -> console and make sure 'persist logs' is enabled (or equivalent). Leave the console open.
3. Submit the form empty
Expected: The form validation will catch the empty field and display a form error message without submitting anything (the field is set to use client validation after all)
Actual: Notice a JS error and that the page posts the form