Search code examples
cssformsdynamics-crmdynamics-marketing

Changing Thank you message DIV CSS in D365 marketing form


Is there any way to change the CSS of div which appear after in D365 marketing form submission? DIV looks below which comes with default height and width. We just need to remove this.

<div class="onFormSubmittedFeedback" style="height: 442px; width: 1169px;">

Solution

  • You can create a javascript hook, react on form submit event and do this via javascript

    Ref: https://learn.microsoft.com/en-us/dynamics365/customer-insights/journeys/developer/marketing-form-client-side-extensibility#form-events

    <script>
    MsCrmMkt.MsCrmFormLoader
    .on("afterFormSubmit", function(event) { 
      const elements = document.getElementsByClassName("onFormSubmittedFeedback");
      for (let i = 0; i < elements.length; i++) {
        elements[i].style.height = "auto";
        elements[i].style.width = "auto";
      }
    })
    </script>