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

mforms searchableselector doesn't disable hidden <option>s

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.8.6, 2.9, 3.0
    • 2.8.9, 2.9.3
    • Forms Library
    • MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MDL-50685_master
    • 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
    • Team Beards Sprint 9, Team Beards Sprint 10
    • 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

              jethac Jetha Chan
              jethac Jetha Chan
              David Monllaó David Monllaó
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Jun Pataleta Jun Pataleta
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Nov/15