Skip to content

Instantly share code, notes, and snippets.

@jammykam
Created October 4, 2017 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jammykam/49d62b6498d0a91e441a1d1a4c84494b to your computer and use it in GitHub Desktop.
Save jammykam/49d62b6498d0a91e441a1d1a4c84494b to your computer and use it in GitHub Desktop.
Sitecore WFFM Input field with Placeholder
using System.ComponentModel;
using Sitecore.Form.Core.Attributes;
namespace MyProject.CMS.Custom.WFFM.Fields
{
public class PlaceholderInput : Sitecore.Form.Web.UI.Controls.SingleLineText
{
[DefaultValue("")]
[VisualCategory("Appearance")]
[VisualProperty("Placeholder Text:", 200)]
[Localize]
public string PlaceholderText { get; set; }
}
}
using System.ComponentModel;
using Sitecore.Forms.Mvc.ViewModels.Fields;
namespace MyProject.CMS.Custom.WFFM.Fields
{
public class PlaceholderInputField : SingleLineTextField
{
[DefaultValue("")]
public string PlaceholderText { get; set; }
}
}
@using Sitecore.Forms.Mvc.Html
@model MyProject.CMS.Custom.WFFM.Fields
@using (Html.BeginField())
{
@Html.Editor("Value", new { FieldModel = Model, htmlAttributes = new { placeholder = Model.PlaceholderText } })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment