Skip to content

Instantly share code, notes, and snippets.

@jammykam
Last active October 4, 2017 18:03
Show Gist options
  • Save jammykam/5e854ab9ecf23c446a0e347fefbc5864 to your computer and use it in GitHub Desktop.
Save jammykam/5e854ab9ecf23c446a0e347fefbc5864 to your computer and use it in GitHub Desktop.
Sitecore WFFM Email Field with Placeholder Text
using System.ComponentModel;
using Sitecore.Form.Core.Attributes;
namespace MyProject.CMS.Custom.WFFM.Fields
{
public class EmailPlaceholder : Sitecore.Form.Web.UI.Controls.Email
{
public new string Text
{
get { return this.textbox.Text; }
set { this.textbox.Text = value; }
}
[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 EmailPlaceholderField : EmailField
{
[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