- None - still shows up, in multiple selects.

Seems like fixing this issue created another issue (bug) which was fixed by oushen, however it was never committed.

And since the bug still persist in the new Select2 version "7.x-1.0+6-dev" on Drupal.select2.js, I thought I should open this new issue here.

When field is not required, the user is able to select - None - as one of the options. It shows up in the little box.

The following fixes the problem temporarily (work around), but doesn't address the issue (no patch yet).

Change this:

if (emptyValueOption) {
	// Checking for empty option exist and set placeholder by its value if
	// placeholder not defined
	if (options.placeholder == undefined) {
		options.placeholder = emptyValueOption.text();
	}
	clearEmptyValueOption = true;
}

To this:

if (emptyValueOption) {
	// Checking for empty option exist and set placeholder by its value if
	// placeholder not defined
	if (options.placeholder == undefined) {
		options.placeholder = emptyValueOption.text();
	}
	clearEmptyValueOption = true;
	$('option[value=""]', $element).html('').removeAttr('selected');
}
CommentFileSizeAuthor
none-can-be-selected.jpg3.79 KBcj-a-min

Comments

cj-a-min created an issue. See original summary.

cj-a-min’s picture

Issue summary: View changes
chr.fritsch’s picture

Component: Code » Field widgets
Status: Active » Closed (outdated)