BUGFIX: Fixed the form state not being saved to the session after a custom validateStep() validation failure.

This commit is contained in:
ajshort 2011-02-06 07:59:59 +11:00
parent 9816df1538
commit 1f1bb225f0
1 changed files with 4 additions and 1 deletions

View File

@ -403,8 +403,11 @@ abstract class MultiForm extends Form {
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)) {
Session::set("FormInfo.{$form->FormName()}.data", $form->getData());
Director::redirectBack();
return false;
}