session->ID}");
if($steps) {
foreach($steps as $step) {
if($step->class == 'Page3PersonalDetailsFormStep') {
$member = new Member();
$data = $step->loadData();
if($data) {
$member->update($data);
$member->write();
}
}
if($step->class == 'Page3OrganisationDetailsFormStep') {
$organisation = new Organisation();
$data = $step->loadData();
if($data) {
$organisation->update($data);
if($member && $member->ID) $organisation->MemberID = $member->ID;
$organisation->write();
}
}
// Debug::show($step->loadData()); // Shows the step data (unserialized by loadData)
}
}
$controller = $this->getController();
$controller->redirect($controller->Link() . 'finished');
}
}
class Page3StartFormStep extends MultiFormStep {
public static $next_steps = 'Page3PersonalDetailsFormStep';
function getFields() {
return new FieldList(
new LiteralField('Details', 'This is important
You will receiving email once you participate in this survey.
Under the new Unsolicited Electronic Messages Act 2007, we must have your consent to send emails relating to this form.
If you do not wish to receive these emails please use the unsubscribe checkbox at bottom of this form.
If you still wish to receive these emails, you do not have to do anything.
For more information visit http://www.silverstripe.com/
'), new CheckboxField('Unsubscribe', 'Tick that you confirm the above details.') ); } } class Page3PersonalDetailsFormStep extends MultiFormStep { public static $next_steps = 'Page3OrganisationDetailsFormStep'; function getFields() { return new FieldList( new TextField('FirstName', 'First name'), new TextField('Surname', 'Surname') ); } } class Page3OrganisationDetailsFormStep extends MultiFormStep { public static $is_final_step = true; function getFields() { return new FieldList( new TextField('OrganisationName', 'Organisation Name') ); } } ?>