mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX: field validation
This commit is contained in:
parent
d8295c2a27
commit
cbeb7a82e8
@ -888,13 +888,19 @@ JS
|
|||||||
|
|
||||||
foreach($this->Fields() as $field) {
|
foreach($this->Fields() as $field) {
|
||||||
$messages[$field->Name] = $field->getErrorMessage()->HTML();
|
$messages[$field->Name] = $field->getErrorMessage()->HTML();
|
||||||
|
$formField = $field->getFormField();
|
||||||
|
|
||||||
if($field->Required && $field->CustomRules()->Count() == 0) {
|
if($field->Required && $field->CustomRules()->Count() == 0) {
|
||||||
if( !isset($data[$field->Name]) ||
|
if(isset($data[$field->Name])) {
|
||||||
|
$formField->setValue($data[$field->Name]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(
|
||||||
|
!isset($data[$field->Name]) ||
|
||||||
!$data[$field->Name] ||
|
!$data[$field->Name] ||
|
||||||
!$field->getFormField()->validate($this->validator)
|
!$formField->validate($form->getValidator())
|
||||||
) {
|
) {
|
||||||
$form->addErrorMessage($field->Name,$field->getErrorMessage()->HTML(),'bad');
|
$form->addErrorMessage($field->Name, $field->getErrorMessage(), 'bad');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user