Silverstripe Version: 4.2.x
Question: When captcha is wrong Formdata is lost
I’m using GitHub - UndefinedOffset/silverstripe-nocaptcha: A spam protector and form field using Google's reCAPTCHA v2 or optionally a foundation v3 implementation with $form->enableSpamProtection().
When one leaves it empty he gets redirected to the form with the error message. But all fields are empty and have to be filled out again.
So I have to save it in the Session like here https://www.silverstripe.org/learn/lessons/v4/introduction-to-frontend-forms-1 described.
But how? My submit function gets never called on Validation error. So when do I save my Session?
And whats that $mappable_fields in FormSpamProtectionExtension for? The function setFieldMapping is not set in booth implementations GitHub - chillu/silverstripe-recaptcha: SilverStripe module for ReCaptcha spam protection service and GitHub - UndefinedOffset/silverstripe-nocaptcha: A spam protector and form field using Google's reCAPTCHA v2 or optionally a foundation v3 implementation
//Where to put:
$session = $this->getRequest()->getSession();
$session->set("FormData.{$form->getName()}.data", $data);
//
//From NocaptchaProtector:
/**
* Not used by Recaptcha
*/
public function setFieldMapping($fieldMapping)
{
}