Fatal error: Call to a member function Services() on null
it's correct?
Member::get()->byId($this->urlParams['ID'])->Services()->map('Title','Title')
thanks for the help!
class MemberProfileViewer extends Page_Controller {
// ...
public function form() {
$fields = new FieldList(
CheckboxSetField::create(
$name = "ServiceID",
$title = "Select",
$source = Member::get()->byId($this->urlParams['ID'])->Services()->map('Title','Title')
),
)
$actions = FieldList::create(
FormAction::create('form', 'Send')
->setUseButtonTag(true)
->addExtraClass('btn btn-primary')
);
$validator = new RequiredFields('ServiceID');
$form = new Form($this, 'form', $fields, $actions, $validator);
$form->setFormMethod('POST', true);
return $form;
}
public function doform($data, $form) {
$form->sessionMessage(
"Thank you, you will be contacted as soon as possible by our consultant.", 'good'
);
$submission = new RequestForm();
$form->saveInto($submission);
$submission->write();
return $this->redirectBack();
}