Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsmSelect does not honour disabled attribute of the underlying select #851

Closed
Toutouwai opened this issue Apr 12, 2019 · 3 comments
Closed

Comments

@Toutouwai
Copy link

Short description of the issue

Inputfields that extend InputfieldSelect such as Select Multiple, Radio Buttons and Checkboxes honour the "disabled" attribute of options - if the option is disabled it may not be selected.

Example:

$wire->addHookBefore('InputfieldSelect::render', function(HookEvent $event) {
	$inputfield = $event->object;
	if($inputfield->hasField != 'colours') return;
	$inputfield->addOptionAttributes(1062, ['disabled' => 'disabled']);
});

2019-04-12_164024
2019-04-12_164042
2019-04-12_164058
2019-04-12_163956

But InputfieldAsmSelect does not honour the disabled attribute of the underlying select that it modifies, allowing disabled options to be selected.

2019-04-12_165306

AsmSelect does support disabled options (it disables items in the dropdown after they have been selected) so I expected it carry over disabled options from the underlying select.

Setup/Environment

  • ProcessWire version: 3.0.129
@Toutouwai
Copy link
Author

Possible fix - replace these lines with:

if($t.is(":selected")) {
	addListItem(id); 
	addSelectOption(id, true); 						
} else if($t.is(":disabled")) {
	addSelectOption(id, true);
} else {
	numActive++;
	addSelectOption(id); 
}

ryancramerdesign added a commit to processwire/processwire that referenced this issue Apr 16, 2019
@ryancramerdesign
Copy link
Member

Thanks @Toutouwai I have pushed your suggested fix for this.

@Toutouwai
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants