Skip to content

Instantly share code, notes, and snippets.

@alasvant
Created February 23, 2019 13:07
Show Gist options
  • Save alasvant/3ae6dba506a466d33ace41c3216c5658 to your computer and use it in GitHub Desktop.
Save alasvant/3ae6dba506a466d33ace41c3216c5658 to your computer and use it in GitHub Desktop.
Sample view to render the TagManagerElementBlock.cs values for editors in edit mode and hidden input fields in the form.
@using EPiServer.Forms.EditView
@using EPiServer.Editor
@model AlloyWithFind.Models.FormElements.TagManagerElementBlock
@* if in edit mode render the GTM values so that the editor can see them *@
@if (PageEditing.PageIsInEditMode)
{
<span class="Form__Element FormHidden @Html.Raw(ConstantsFormsUI.CSS_InvisibleElement)">@Model.EditViewFriendlyTitle</span>
}
else
{
<input name="gtmFormName" id="@(Model.FormElement.Guid)_name" type="hidden" value="@Model.FormName" class="Form__Element FormHidden FormHideInSummarized" @Html.Raw(Model.AttributesString) data-f-type="hidden" />
<input name="gtmCategoryName" id="@(Model.FormElement.Guid)_category" type="hidden" value="@Model.CategoryName" class="Form__Element FormHidden FormHideInSummarized" @Html.Raw(Model.AttributesString) data-f-type="hidden" />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment