Created
October 4, 2017 18:07
-
-
Save jammykam/49d62b6498d0a91e441a1d1a4c84494b to your computer and use it in GitHub Desktop.
Sitecore WFFM Input field with Placeholder
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 PlaceholderInput : Sitecore.Form.Web.UI.Controls.SingleLineText | |
{ | |
[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 PlaceholderInputField : SingleLineTextField | |
{ | |
[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