My site uses WFFM and my client wants the ability to override the Submit button text on specific pages - some of the forms are used across many pages, and my client wants to be able to change the text on just ONE page without changing it on every other page, using a field on the page template called Submit Button Override Text.

I'm not really sure where to start with this as I haven't been able to find any documentation on overriding the WFFM submit button HTML. How could I accomplish this, and can someone provide some documentation that would get me started?

1 Answer 1


Overriding the submit button turns out to be pretty simple -- create a custom BootstrapSubmit method:

namespace Library.Models.ViewModels.Form
public static class WFFMHtmlHelperExtensions
    public static MvcHtmlString CustomBootstrapSubmit(this HtmlHelper helper, string title = null)
        TagBuilder tagBuilder1 = new TagBuilder("input");
        tagBuilder1.Attributes.Add("type", "submit");
        ISubmitSettings model1 = helper.ViewData.Model as ISubmitSettings;
        string btnSize = string.Empty;
        string btnType = string.Empty;
        string btnText = string.Empty;
        string btnPos = string.Empty;
        if (model1 != null)
            btnSize = model1.SubmitButtonSize;
            btnType = model1.SubmitButtonType;
            btnText = model1.SubmitButtonName;
            btnPos = model1.SubmitButtonPosition;

        tagBuilder1.Attributes.Add("value", btnText);

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.Append("btn").Append(" ").Append(btnSize).Append(" ").Append(btnType);
        IStyleSettings model2 = helper.ViewData.Model as IStyleSettings;
        if (model2 != null && model2.FormType != FormType.Inline)
            TagBuilder tagBuilder2 = new TagBuilder("div");
            tagBuilder2.AddCssClass(("form-submit-border " + btnPos).Trim());
            tagBuilder2.InnerHtml += tagBuilder1.ToString();
            return MvcHtmlString.Create(tagBuilder2.ToString());
        return MvcHtmlString.Create(tagBuilder1.ToString());

-- add whatever modifications you want inside there- in my case, setting the button text from a page field:

var pageItem = Sitecore.Context.Item?.GlassCast<ICampaign_Gating_Page>();
if (pageItem != null && !String.IsNullOrEmpty(pageItem.Form_CTA_Override_Text))
    btnText = pageItem.Form_CTA_Override_Text;

... and then in FormViewModel.cshtml (which should live under /Views/Form/EditorTemplates), replace @Html.BootstrapSubmit() with @Html.CustomBootstrapSubmit()

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.