diff --git a/src/Control/ElementFormController.php b/src/Control/ElementFormController.php index 5f9ee1e..082ccbc 100644 --- a/src/Control/ElementFormController.php +++ b/src/Control/ElementFormController.php @@ -70,9 +70,17 @@ public function finished() */ public function Link($action = null) { - $id = $this->element->ID; - $segment = Controller::join_links('element', $id, $action); $page = Director::get_current_page(); + $id = $this->element->ID; + + if ($this->getAction() === 'finished' + && $action !== 'finished' + && $this->getRequest()->param('ID') == $id + ) { + $segment = $action; + } else { + $segment = Controller::join_links('element', $id, $action); + } if ($page && !($page instanceof ElementController)) { return $page->Link($segment); diff --git a/src/Model/ElementForm.php b/src/Model/ElementForm.php index 184fe67..350d3c3 100644 --- a/src/Model/ElementForm.php +++ b/src/Model/ElementForm.php @@ -32,9 +32,10 @@ public function Form() { $controller = UserDefinedFormController::create($this); $current = Controller::curr(); - $controller->setRequest($current->getRequest()); + $request = $current->getRequest(); + $controller->setRequest($request); - if ($current && $current->getAction() == 'finished') { + if ($current && $current->getAction() == 'finished' && $request->param('ID') == $this->ID) { return $controller->renderWith(UserDefinedFormController::class .'_ReceivedFormSubmission'); }