waseem02 / jquery-asmselect

Automatically exported from code.google.com/p/jquery-asmselect
0 stars 0 forks source link

Disable select multiple #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
- What steps will reproduce the problem?
1. Add the attribute disabled (for xhtml: disabled="disabled") to the asm
element.

- What is the expected output? What do you see instead?
The select element will be disabled. Instead the element will show up as if
it wasn't disabled.

- What version of the product are you using? On what operating system?
1.0.4a beta

- Please provide any additional information below.
My solution: change line 406

init()

to:

if(!$original.attr("disabled"))
    init();

Original issue reported on code.google.com by Fdries...@gmail.com on 22 Sep 2009 at 8:14

GoogleCodeExporter commented 8 years ago
Wrong solution. The correct one is to change code from line 178.

Find:
===
if($t.is(":selected")) {
    addListItem(id); 
    addSelectOption(id, true);                      
} else {
    addSelectOption(id); 
}

===

And replace by that:
===
if($t.is(":selected") && !$t.is(":disabled")) {
    addListItem(id); 
    addSelectOption(id, true);                      
} else if (!$t.is(":selected") && $t.is(":disabled")) {
    addSelectOption(id, true); 
} else {
    addSelectOption(id); 
}
===

Original comment by svya...@gmail.com on 8 Apr 2010 at 1:12

GoogleCodeExporter commented 8 years ago
I agree, that is a better solution!

Original comment by Fdries...@gmail.com on 8 Apr 2010 at 7:35

GoogleCodeExporter commented 8 years ago
Thanks for posting this solution. 

Original comment by ryancram...@gmail.com on 10 Jul 2010 at 4:12