Open dbalosetti opened 2 years ago
i would like to add that we have noticed that it happens only when is present also send email submit action
Sounds you are on Sitecore version 10.0 or earlier. The GetStringValue()
method that SFE 4.0+ relies on was introduced in 10.1
Confirm which Sitecore version you're on (Desktop -> All Applications -> System -> License details) and install the latest SFE 3 version for 9.x or 10.0
Hmm We got this too, We are on Sitecore 10.1. Tried to downgrade to 3.2 and still the same. @asontu
Coming back here for a possible fix. You don't need to downgrade. TLDR: Inherit and Modify.
This only happens on SendEmail because SendEmail calls
ReflectionUtil.CallMethod((object) postedField, "GetStringValue").ToString();
Which we don't have any implemented at ReCaptchaModel
So there are two possible ways to fix this
Then change the model path from Content Tree at Sitecore Settings e.g
public class CustomReCaptchaModel : ReCaptchaModel
{
....
public string GetStringValue(){
return String.empty;
}
}
ReflectionUtil.CallMethod((object) postedField, "GetStringValue").ToString();
will suffice, however you could also just use the GetMethod to conditionally check it.
2.2 Make sure to edit your Form Submit Action Item to point to your custom SubmitActions which typically sits at
/sitecore/system/Settings/Forms/Submit Actions/And that's it!. Your Send Email Action will now work fine.
When we add the recaptcha module we get an exception when we try to submit the form:
5952 11:03:25 ERROR [Experience Forms]: Unknown method 'GetStringValue' (type: Feature.FormsExtensions.Fields.ReCaptcha.ReCaptchaModel) Exception: System.InvalidOperationException Message: Unknown method 'GetStringValue' (type: Feature.FormsExtensions.Fields.ReCaptcha.ReCaptchaModel) Source: Sitecore.Kernel at Sitecore.Reflection.ReflectionUtil.CallMethod(Object obj, String methodName, Boolean includeNonPublic, Boolean includeInherited) at Sitecore.ExperienceForms.Mvc.Processing.SubmitActions.SendEmail.GetFieldValue(IViewModel postedField) at Sitecore.ExperienceForms.Mvc.Processing.SubmitActions.SendEmail.ReplaceFieldValues(String content, FormSubmitContext formSubmitContext) at Sitecore.ExperienceForms.Mvc.Processing.SubmitActions.SendEmail.SetMessageAttributes(MailMessage message, SendEmailData data, FormSubmitContext formSubmitContext) at Sitecore.ExperienceForms.Mvc.Processing.SubmitActions.SendEmail.Execute(SendEmailData data, FormSubmitContext formSubmitContext)
To Reproduce
We are using the 4.0.2