mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 09:05:49 +00:00
Merge pull request #1 from ajshort/master
BUGFIX Make The Controller And Form Name Available For Field Construction
This commit is contained in:
commit
c73082e2ab
@ -86,7 +86,12 @@ abstract class MultiForm extends Form {
|
|||||||
if(isset($_GET['MultiFormSessionID'])) {
|
if(isset($_GET['MultiFormSessionID'])) {
|
||||||
$this->setCurrentSessionHash($_GET['MultiFormSessionID']);
|
$this->setCurrentSessionHash($_GET['MultiFormSessionID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First set the controller and name manually so they are available for
|
||||||
|
// field construction.
|
||||||
|
$this->controller = $controller;
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
// Set up the session for this MultiForm instance
|
// Set up the session for this MultiForm instance
|
||||||
$this->setSession();
|
$this->setSession();
|
||||||
|
|
||||||
@ -398,8 +403,11 @@ abstract class MultiForm extends Form {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// custom validation (use MultiFormStep->getValidator() for built-in functionality)
|
// Perform custom step validation (use MultiFormStep->getValidator() for
|
||||||
|
// built-in functionality). The data needs to be manually saved on error
|
||||||
|
// so the form is re-populated.
|
||||||
if(!$this->getCurrentStep()->validateStep($data, $form)) {
|
if(!$this->getCurrentStep()->validateStep($data, $form)) {
|
||||||
|
Session::set("FormInfo.{$form->FormName()}.data", $form->getData());
|
||||||
Director::redirectBack();
|
Director::redirectBack();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user