mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
MINOR Tidied-up formatting
This commit is contained in:
parent
a7a3dcb945
commit
8f8eab018c
@ -643,27 +643,24 @@ JS
|
|||||||
*/
|
*/
|
||||||
function process($data, $form) {
|
function process($data, $form) {
|
||||||
|
|
||||||
if($this->Fields()) {
|
Session::set("FormInfo.{$form->FormName()}.data",$data);
|
||||||
Session::set("FormInfo.{$form->FormName()}.data",$data);
|
Session::clear("FormInfo.{$form->FormName()}.errors");
|
||||||
Session::clear("FormInfo.{$form->FormName()}.errors");
|
foreach($this->Fields() as $field) {
|
||||||
foreach($this->Fields() as $field) {
|
$messages[$field->Name] = $field->getErrorMessage()->HTML();
|
||||||
$messages[$field->Name] = $field->getErrorMessage()->HTML();
|
|
||||||
|
|
||||||
if($field->Required){
|
if($field->Required){
|
||||||
if( !isset($data[$field->Name]) ||
|
if( !isset($data[$field->Name]) ||
|
||||||
!$data[$field->Name] ||
|
!$data[$field->Name] ||
|
||||||
!$field->getFormField()->validate($this->validator)
|
!$field->getFormField()->validate($this->validator)
|
||||||
){
|
){
|
||||||
$form->addErrorMessage($field->Name,$field->getErrorMessage()->HTML(),'bad');
|
$form->addErrorMessage($field->Name,$field->getErrorMessage()->HTML(),'bad');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if(Session::get("FormInfo.{$form->FormName()}.errors")){
|
||||||
}
|
Director::redirectBack();
|
||||||
|
return;
|
||||||
if(Session::get("FormInfo.{$form->FormName()}.errors")){
|
|
||||||
Director::redirectBack();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$submittedForm = Object::create('SubmittedForm');
|
$submittedForm = Object::create('SubmittedForm');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user