mirror of
https://github.com/silverstripe/silverstripe-spamprotection.git
synced 2024-10-22 14:05:59 +02:00
Set Form for formField when validating
When using EditableSpamProtectionField with UserForms 3.0, forms with a spam protector field (defined from FormSpamProtectorExtension), form submissions return an error: PHP Fatal error: Call to a member function FormName() on a non-object This because the exemplar formField generated by getFormField() does not have any connection to the particular form being submitted. This is fixed with a simple setForm() call in the validateField() function
This commit is contained in:
parent
ad6e97dacb
commit
14e768ca32
@ -142,7 +142,8 @@ if (class_exists('EditableFormField')) {
|
||||
public function validateField($data, $form)
|
||||
{
|
||||
$formField = $this->getFormField();
|
||||
|
||||
$formField->setForm($form);
|
||||
|
||||
if (isset($data[$this->Name])) {
|
||||
$formField->setValue($data[$this->Name]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user