Last active
October 4, 2017 18:03
-
-
Save jammykam/5e854ab9ecf23c446a0e347fefbc5864 to your computer and use it in GitHub Desktop.
Sitecore WFFM Email Field with Placeholder Text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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