Select multiple submitting problem when an option is both selected and disabled

Issue #15371953 • Assigned to Steven K.

Details

Author
evgeny r.
Created
Jan 8, 2018
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
41.16299
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

In the following example:

<select multiple name="select" id="select">
  <option selected value="0">0</option>
  <option selected disabled value="">a disabled option</option>
  <option value="1">1</option>
  <option selected value="2">2</option>
</select>

Only the option with the value of 0 is submitted which is the the only option that appears before the selected disabled option.

I think that all of the other browsers (including IE 11) ignore the selected disabled option and submit all of the selected options (0 and 2 in this example).

The standards don’t seem to address the specific selected disabled case so I think that having such an option shouldn’t “break” the control, but the browser developers may have better arguments.

Here’s a full JSFiddle in case you’d like to try it immediately: https://jsfiddle.net/argaz/gf1fuvu2/

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Steven K.”

    • Hi Evgeny,

      Can you tell me the use case for this?  For example, what would break by not allowing a disabled select option.

      I tested in Edge and in Chrome and am getting an HTTP 403 error “CSFR verfication failed.”  I believe that is a different issue.  Can you update the repro in jsfiddle to call a basic javascript method.  I want to make sure we are seeing the same issue.

      Appreciate the help,

      Steve

    • My personal use case was kind of a coding error because I was using a UI framework that “styles” the select element by hiding the actual select and displaying other elements as the select (http://materializecss.com/forms.html#select) and I used their documentation example which had a selected disabled option as the placeholder option. I feel like it’s an easy mistake to make because the selected disabled option is a common template for single select and it’s pretty easy to convert a single select to multiple select by just adding the multiple attribute.

      A more legitimate case I can think of is having the select display an actual user option that has to be selected (I don’t consider it particularly user friendly but I think that it should be legal). For example:

      Choose what applies to you
      
      
        Citizen
      
        Student
      
        Senior
      
        Veteran
      
      
      
      

      Don’t worry about the “CSRF” error in the fiddle, The form is still submitted and you can look at what’s being submitted using Dev Tools.

    • looks like my html example in the comment got filtered, here’s the encoded version:

      <label>Choose what applies to you</label>
      <select multiple>
        <option selected disabled>Citizen</option>
        <option>Student</option>
        <option>Senior</option>
        <option>Veteran</option>
      </select>
      
    • looks like my html example in the comment got filtered, here’s the encoded version:

      <label>Choose what applies to you</label>
      <select multiple>
        <option selected disabled>Citizen</option>
        <option>Student</option>
        <option>Senior</option>
        <option>Veteran</option>
      </select>
      
    • I appreciate the detailed response about the use cases and wanted to let you know I haven’t forgotten about this.

    You need to sign in to your Microsoft account to add a comment.

    Sign in