SaaS CMS has officially launched! Learn more now.

Episerver Forms - reCaptcha not working


ive installed the episerver.forms.samples package and added the required javascript in order to get the recaptcha working however when i submit the form, it always returns with the invalid captcha value error

Aug 16, 2017 22:37

Is it displaying the reCaptcha element correctly? Could you debug into the validation method ("EPiServer.Forms.Samples.Implementation.Validation.RecaptchaValidator" function) to know anything went wrong?

Aug 17, 2017 9:16

I don't think you have to add any JavaScript to the page in order to make the recaptchaElement works.

Aug 17, 2017 13:34

After installing the package, i added the code

<script src="<%: Model.GetExtraResources().First().Item2 %>"></script>
<script src="<%: Model.GetExtraResources().Last().Item2 %>"></script>

in order to load in the RecaptchaElementBlock.js and the reCaptcha api. The recaptcha element loads in and show up. 

However it seems like the validate method never gets called therefore always resulting in invalid captcha value. Am i supposed to call it manually?

Edited, Aug 17, 2017 15:51

Hi, you don't have to inject any script.

Recaptcha Element does it himself.

Have just tested with Forms 4.6.1 and Forms.Samples 3.3.2.

Sidenote: your site view template should have correct tag for registering client resources, please see it here.

Aug 18, 2017 6:18


I am stuck with a similar situation. ive installed the episerver.forms.samples package and added the required javascript in order to display the recaptcha.

however when i submit the form, it always returns with the invalid captcha value error.

I have debugged into the validation method ("EPiServer.Forms.Samples.Implementation.Validation.RecaptchaValidator" function) and could find that that the GetSubmitted value function is returning null.

submitData = HttpContext.Current.Request.HttpMethod == "POST" ? HttpContext.Current.Request.Form : HttpContext.Current.Request.QueryString;
submitData["g-recaptcha-response"] is always null.

Edited, Aug 07, 2018 11:19

Hi, you don't have to add any script in order to use RecaptchaElement. See my previous post.

Aug 07, 2018 11:46


The captcha element is getting displayed but in the validator the submitted value is comming as null.

Aug 07, 2018 12:27


I've verified the Forms Samples package 3.4.0 and it is working. Can you try with new fresh AlloyMVC site to make sure there is no custom code invoked during the submit process? 

Aug 08, 2018 5:03

Hi Halima,

Please check your API keys Register Google API Keys

I've tried using Forms ver 4.11 along with Forms.Sample and it is still fine.


Aug 08, 2018 5:38

Do we have a guide to implement reCaptch v3 in Episerver 11?

Jan 03, 2019 9:54

I think we don't have yet.

Jan 04, 2019 8:03
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.