When I started creating forms in Sitecore module Webforms for Marketers (WFFM), the first thing that popped up was how do I add placeholder attribute in the textbox. I am sure many of you might get stuck on this issue, so here I explain how can one add the placeholder attribute in Sitecore Web Forms for Marketers.

To begin, you need to create a class that inherits from SingleLineText with an additional property “Placeholder”.

public class SingleLineText : Sitecore.Form.Web.UI.Controls.SingleLineText



[VisualFieldType(typeof(TextAreaField)), Localize]

[VisualProperty(“PlaceholderText:”, 100)]

public string PlaceholderText { get; set; }

protected override void DoRender(HtmlTextWriter writer)


this.textbox.Attributes.Add(“placeholder”, this.PlaceholderText);




Further you can create a new custom field type item under /sitecore/System/Modules/Settings/Field Types/Custom. 

Set Assembly and the Class. Oh yes! You also need to add Count Chars and Regex Pattern validation.

Finally set “Textbox with placeholder” custom field type in Form Designer and Placeholder Text.

And you are done. Webforms for Marketers field type with a placeholder attribute is ready for use!

Posted by Advaiya

    Let's connect to make technology work for you.

    Please tick the options most relevant to your business challenges
    Decision makingBusiness productivityCustomer experienceTechnology-led innovationDigital transformation

    [By using this form you agree with the storage and handling of your data by this website.]