-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
3.7.8, 3.8.5, 3.9.2, 3.10
-
None
-
MOODLE_310_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
-
Just like a normal select element, in autocompliete elements, a user should only be able to select an item from what is provided in the list of options. If "" (an empty string) is not within the options, then when the form first loads, the choice should not be blank, and the user should not be able to de-select the current value.
Before MDL-57680, users could sometimes clear the current value, and sometimes could not, depending on what previous actions they had take. That issue made the behaviour consistent, but probably in the wrong way.
This is just an example of how to reproduce the bug, but it can be replicated on many other pages as well:
- log in as admin
- Go to Site administration > Courses > Manage courses and categories
- Click on the "Create new course" button
- Type something in the "Course full name" and "Course short name" fields
- Clear the "Course category" field
- Submit the form
You'll see the following error:
Can't find data record in database table course_categories.More information about this error
|
|
Debug info: SELECT * FROM {course_categories} WHERE id IS NULL
|
[array (
|
)]
|
Error code: invalidrecord
|
|
Stack trace:
|
* line 1646 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
|
* line 1622 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
|
* line 2322 of /course/lib.php: call to moodle_database->get_record()
|
* line 162 of /course/edit.php: call to create_course()
|
|
Output buffer: <br /> <b>Notice</b>: Undefined property: stdClass::$category in <b>/opt/app/course/lib.php</b> on line <b>2322</b><br />
|
- duplicates
-
MDL-58988 When autocomplete form element is not multiple, i cannot deselect item
- Closed
- has a non-specific relationship to
-
MDL-72309 Course creation without category
- Closed
- is a regression caused by
-
MDL-57680 Autocomplete Form API: Can't clear single-select value, and does not fire change event
- Closed