Recaptcha with multi step form should not validate on 'Next' step
Just started using the reCAPTCHA plugin by Alex Skrypnyk.
Works great, except when using the reCAPTCHA on a multi step (multipage) form.
Usually, the reCAPTCHA field will be used on the last page of the form.
However, when clicking next, the FormValidate event is triggered, and the reCAPTCHA is always checked.
The reCAPTCHA field should only be checked if the reCAPTCHA field is on the current form page. I'm not sure though this info is available via the FormValidationEventArgs...?
we've got a piece of code by Matt Barlow for our Forms-on-Steroids-package (https://our.umbraco.org/projects/backoffice-extensions/umbraco-forms-on-perplex-steroids/) that also includes a ReCaptcha that solves this specific issue.
It will probably give some inspiration for your fix too (https://our.umbraco.org/projects/backoffice-extensions/umbraco-forms-on-perplex-steroids/feedback-bugs/87162-recaptchav2-on-forms-with-multiple-pages-cant-navigate-between-form-pages).
Works OK on page 1 - when applied to the last page, I get the following error when I try to progress form Page 1
The operation has timed out
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The operation has timed out
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[WebException: The operation has timed out]
System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +365
System.Net.WebClient.DownloadString(Uri address) +111
PerplexUmbraco.Forms.Code.UmbracoEvents.RecaptchaValidate(Object sender, FormValidationEventArgs e) +572
Umbraco.Forms.Web.Controllers.UmbracoFormsController.ValidateFormState(FormViewModel model, Form form, HttpContextBase context, Boolean captchaIsValid) +1719
Umbraco.Forms.Web.Controllers.UmbracoFormsController.HandleForm(FormViewModel model, Boolean captchaIsValid) +348
lambda_method(Closure , ControllerBase , Object[] ) +195
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +209
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +385
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +385
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +385
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +385
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +385
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +30
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +393
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +12
Recaptcha with multi step form should not validate on 'Next' step
Just started using the reCAPTCHA plugin by Alex Skrypnyk. Works great, except when using the reCAPTCHA on a multi step (multipage) form.
Usually, the reCAPTCHA field will be used on the last page of the form. However, when clicking next, the FormValidate event is triggered, and the reCAPTCHA is always checked.
The reCAPTCHA field should only be checked if the reCAPTCHA field is on the current form page. I'm not sure though this info is available via the FormValidationEventArgs...?
Cheers, EJ
Hi EJS
I will have a look on this problem, thanks for submitting the issue.
Thanks,
ALex
Hi Alex,
we've got a piece of code by Matt Barlow for our Forms-on-Steroids-package (https://our.umbraco.org/projects/backoffice-extensions/umbraco-forms-on-perplex-steroids/) that also includes a ReCaptcha that solves this specific issue.
It will probably give some inspiration for your fix too (https://our.umbraco.org/projects/backoffice-extensions/umbraco-forms-on-perplex-steroids/feedback-bugs/87162-recaptchav2-on-forms-with-multiple-pages-cant-navigate-between-form-pages).
Cheerio,
Jeffrey
I am having this issue on a multi-page form:
Umbraco Forms 6.0.6
Umbraco version 7.7.8 assembly: 1.0.6582.14881
Works OK on page 1 - when applied to the last page, I get the following error when I try to progress form Page 1
is working on a reply...