AI OnAI Off
You can override method BuildReturnResultForSubmitAction in DataSubmissionService as below and register dependency in initialization module. It should work.
public class CustomDatasubmissionService : DataSubmissionService
{
protected override SubmitActionResult BuildReturnResultForSubmitAction(bool isJavaScriptSupport, bool isSuccess, IEnumerable<string> errorMessages, HttpContextBase httpContext,
FormContainerBlock formContainer = null, Dictionary<string, object> additionalParams = null, SubmissionInfo submissionInfo = null,
Submission submission = null, bool isProgressiveSubmit = false, string redirectUrl = "")
{
var message = string.Join("<br/>", errorMessages);
foreach (var msg in errorMessages)
{
_logger.Error(msg);
}
// the default behavior, that's why an additional message was added
//return BuildReturnResultForSubmitAction(isJavaScriptSupport, false, LocalizationService.GetString("/episerver/forms/messages/formsubmission/submitnotsuccess") + message, httpContext, formContainer);
// don't add an additional message
return BuildReturnResultForSubmitAction(isJavaScriptSupport, false, message, httpContext, formContainer);
}
}
Calvin,
If someone answers your question, please click the Mark Answer button. Thank you.
I have created a custom form actor that sends form data to an external service. If the form does not submit successfully to this service I create a SubmissionActorResult object and set it to cancel submit and add an error message to it. When this result object gets sent back to the form and displays the error on the form page it has an additional error messege prepended to the one I wrote to the result object. It always adds "Failed to submit." In front of the error message That I wrote.
I can't find where this message comes from. I would like to remove it or at the least localize it but I can't find how to do this.
Thanks,
Calvin