mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #611 from xini/fix-multioptionfields
fix default values for EditableMultipleOptionField subclasses, fixes #610
This commit is contained in:
commit
fe98baf75e
@ -22,7 +22,7 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField
|
||||
// Set the default checked items
|
||||
$defaultCheckedItems = $this->getDefaultOptions();
|
||||
if ($defaultCheckedItems->count()) {
|
||||
$field->setDefaultItems($defaultCheckedItems->map('EscapedTitle')->keys());
|
||||
$field->setDefaultItems($defaultCheckedItems->map('Value')->keys());
|
||||
}
|
||||
|
||||
$this->doUpdateFormField($field);
|
||||
|
@ -38,7 +38,7 @@ class EditableDropdown extends EditableMultipleOptionField
|
||||
// Set default
|
||||
$defaultOption = $this->getDefaultOptions()->first();
|
||||
if ($defaultOption) {
|
||||
$field->setValue($defaultOption->EscapedTitle);
|
||||
$field->setValue($defaultOption->Value);
|
||||
}
|
||||
$this->doUpdateFormField($field);
|
||||
return $field;
|
||||
|
@ -75,6 +75,10 @@ class EditableOption extends DataObject
|
||||
return $this->canEdit($member);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 5.0 Use "$Title.XML" in templates instead
|
||||
* @return string
|
||||
*/
|
||||
public function getEscapedTitle()
|
||||
{
|
||||
return Convert::raw2att($this->Title);
|
||||
|
@ -34,7 +34,7 @@ class EditableRadioField extends EditableMultipleOptionField
|
||||
// Set default item
|
||||
$defaultOption = $this->getDefaultOptions()->first();
|
||||
if ($defaultOption) {
|
||||
$field->setValue($defaultOption->EscapedTitle);
|
||||
$field->setValue($defaultOption->Value);
|
||||
}
|
||||
$this->doUpdateFormField($field);
|
||||
return $field;
|
||||
|
Loading…
Reference in New Issue
Block a user