mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #794 from creamarketing/ListboxField_Inconsistency
FIX: ListBoxField and DropdownField should respect getSource()
This commit is contained in:
commit
15f40af4eb
@ -236,7 +236,7 @@ class DropdownField extends FormField {
|
||||
}
|
||||
|
||||
function performReadonlyTransformation() {
|
||||
$field = new LookupField($this->name, $this->title, $this->source);
|
||||
$field = new LookupField($this->name, $this->title, $this->getSource());
|
||||
$field->setValue($this->value);
|
||||
$field->setForm($this->form);
|
||||
$field->setReadonly(true);
|
||||
|
@ -224,7 +224,7 @@ class ListboxField extends DropdownField {
|
||||
// They're silently ignored and overwritten the next time the field is saved.
|
||||
parent::setValue($parts);
|
||||
} else {
|
||||
if(!in_array($val, array_keys($this->source))) {
|
||||
if(!in_array($val, array_keys($this->getSource()))) {
|
||||
throw new InvalidArgumentException(sprintf(
|
||||
'Invalid value "%s" for multiple=false',
|
||||
Convert::raw2xml($val)
|
||||
|
Loading…
Reference in New Issue
Block a user