mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
BUGFIX: fixed memberlist field
This commit is contained in:
parent
6e3f9668c0
commit
9179149446
@ -197,6 +197,9 @@ class UserDefinedForm_Controller extends Page_Controller {
|
||||
foreach($this->Fields() as $field) {
|
||||
|
||||
$fieldToAdd = $field->getFormField();
|
||||
|
||||
if(!$fieldToAdd) break;
|
||||
|
||||
$fieldValidationOptions = array();
|
||||
|
||||
// Set the Error Messages
|
||||
@ -368,8 +371,8 @@ JS
|
||||
$submittedField->Name = $field->Name;
|
||||
$submittedField->Title = $field->Title;
|
||||
|
||||
if($field->hasMethod( 'getValueFromData' )) {
|
||||
$submittedField->Value = $field->getValueFromData( $data );
|
||||
if($field->hasMethod('getValueFromData')) {
|
||||
$submittedField->Value = $field->getValueFromData($data);
|
||||
}
|
||||
else {
|
||||
if(isset($data[$field->Name])) $submittedField->Value = $data[$field->Name];
|
||||
|
@ -10,8 +10,19 @@ class EditableMemberListField extends EditableFormField {
|
||||
|
||||
static $plural_name = 'Member list fields';
|
||||
|
||||
function ExtraOptions() {
|
||||
$groupID = ($this->getSetting('GroupID')) ? $this->getSetting('GroupID') : 0;
|
||||
$groups = DataObject::get("Group");
|
||||
if($groups) $groups = $groups->toDropdownMap('ID', 'Title');
|
||||
$fields = new FieldSet(
|
||||
new DropdownField("Fields[$this->ID][CustomSettings][GroupID]", _t('EditableFormField.GROUP', 'Group'), $groups, $groupID)
|
||||
);
|
||||
$fields->merge(parent::ExtraOptions());
|
||||
|
||||
return $fields;
|
||||
}
|
||||
function getFormField() {
|
||||
return ($this->getSetting($this->GroupID)) ? new DropdownField( $this->Name, $this->Title, Member::mapInGroups($this->getSetting($this->GroupID))) : false;
|
||||
return ($this->getSetting('GroupID')) ? new DropdownField( $this->Name, $this->Title, Member::mapInGroups($this->getSetting('GroupID'))) : false;
|
||||
}
|
||||
|
||||
function getValueFromData($data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user