Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50685

mforms searchableselector doesn't disable hidden <option>s

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.6, 2.9, 3.0
    • Fix Version/s: 2.8.9, 2.9.3
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide

      Setup

      • Open admin/webservice/forms.php and edit line 117, the line that adds a searchableselector for requiredcapability, and add the multiple option as follows:

        $mform->addElement('searchableselector', 'requiredcapability',
                        get_string('requiredcapability', 'webservice'), $capabilitychoices, ['multiple' => true]);
        

      • Purge your cache.

      In all browsers...

      • Go to the add a new webservice screen (admin/webservice/service.php?id=0) and click "Show more..." to display the search select box.
      • Type 'ca' into the search box and observe that items are being filtered.
      • Export jQuery to the global scope by entering the following into your JS console:

        require(['jquery'], function(jquery) { window.jQuery = jquery; });
        

      • Shift-select from mod/quiz:emailwarnoverdue to block/calendar_upcoming:addinstance, making a visual note of the number of visible options being selected.
      • Check in your console that the collection of selected options is of the same size using jQuery:

        jQuery(':selected').length
        

      Show
      Setup Open admin/webservice/forms.php and edit line 117, the line that adds a searchableselector for requiredcapability, and add the multiple option as follows: $mform->addElement('searchableselector', 'requiredcapability', get_string('requiredcapability', 'webservice'), $capabilitychoices, ['multiple' => true]); Purge your cache. In all browsers... Go to the add a new webservice screen ( admin/webservice/service.php?id=0 ) and click "Show more..." to display the search select box. Type 'ca' into the search box and observe that items are being filtered. Export jQuery to the global scope by entering the following into your JS console: require(['jquery'], function(jquery) { window.jQuery = jquery; }); Shift-select from mod/quiz:emailwarnoverdue to block/calendar_upcoming:addinstance, making a visual note of the number of visible options being selected. Check in your console that the collection of selected options is of the same size using jQuery: jQuery(':selected').length
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-50685_master
    • Sprint:
      Team Beards Sprint 9, Team Beards Sprint 10
    • Issue size:
      Small

      Description

      The mforms searchableselector has some issues when multiple selection is enabled. After typing a query string and restricting the select box to that search scope, when trying to do a shift-selection from one element to another, the select box will erroneously select hidden items that are within that range as well.

      This can be addressed by modifying existing javascript that hides elements to also disable them.

      This mainly affects Firefox.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jethac Jetha Chan
              Reporter:
              jethac Jetha Chan
              Peer reviewer:
              David Monllaó
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Jun Pataleta
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/15