When I add a Sitecore Form to a page via the Experience Editor that has a "Submit email" type field I get a JavaScript error that breaks the experience editor. I then have to remove the form from the page via the content editor. I can also go into the form designer and remove the "submit email" field, save the form, and that will prevent the error. I need this field though to tell the form where to send the content. The error in the console says that it is in the ConfigureOptimizationStrip.js file located at http://my-domain/-/speak/v1/ribbon/ConfigureOptimizationStrip.js. Unfortunately, I don't think this file is a part of my project and is instead a part of Sitecore. Has anyone else experienced this issue or know how to fix it?

enter image description here

Here is the script for the SubmitEmail.cshtml:

@model Foundation.Forms.Models.SubmitEmailViewModel
<input id="@Html.IdFor(m => Model.Value)" name="@Html.NameFor(m => Model.Value)" type="hidden" value="@Model.EmailAddress" />
<script type="text/javascript">
    var hiddenField = document.getElementById(@Html.Raw("\"" + Html.IdFor(m => Model.Value) + "\""));
    var parent = hiddenField.parentNode;
    if (parent.classList.contains("sc-formdesign-fieldcontainer")) {
        var textDiv = document.createElement("div");
        textDiv.innerHTML = "(Hidden submit email field)";
  • Are you talking about the ootb "Send Email Campaign Message" submit action? Or an email field? "Submit email" does sound custom.. can you show us that item in Sitecore?
    – Gatogordo
    Commented Mar 13, 2019 at 9:50
  • I just looked and it is a custom field type. I updated the original question with a screenshot and the code from the view. Commented Mar 14, 2019 at 14:43

1 Answer 1


I found the solution. When this was created the variable, "parent" already exists in scope so this code is changing that variable and causing the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.