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:
Ian Walls 2016-03-02 11:51:13 -05:00
parent ad6e97dacb
commit 14e768ca32
1 changed files with 2 additions and 1 deletions

View File

@ -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]);
}