I have created custom attributes on standard fields by following instructions in this post: Creating custom data attribute for Sitecore form fields E.g., Single line input, multi line input etc. I can populate them when in the content tree just fine: enter image description here

And it renders the values on the page as you can see: enter image description here

Problem is, when in forms designer mode, the values that I have entered in the content tree mode for my custom attributes dont get populated. If I manually re-enter them here and hit apply, they get cleared out. enter image description here

Any idea what is going on? Did I miss a setting somewhere? Here is the model:

using System;
using Sitecore.Data.Items;
using Sitecore.ExperienceForms.Mvc.Models.Fields;
using Sitecore;
namespace Helix.Foundation.Forms.Fields
    public class CustomSingleLineViewModel : StringInputViewModel
        public string AriaLabel { get; set; }
        public string AriaRequired { get; set; }
        public string AutoComplete { get; set; }
        protected override void InitItemProperties(Item item)
            AriaLabel = StringUtil.GetString(item.Fields["aria-label"]);
            AriaRequired = StringUtil.GetString(item.Fields["aria- 
            AutoComplete = StringUtil.GetString(item.Fields["autocomplete"]);
         protected override void UpdateItemFields(Item item)
             item.Fields["aria-label"]?.SetValue(AriaLabel, true);
             item.Fields["aria-required"]?.SetValue(AriaRequired, true);
            item.Fields["autocomplete"]?.SetValue(AutoComplete, true);

@using Sitecore.ExperienceForms.Mvc.Html
@model Helix.Foundation.Forms.Fields.CustomSingleLineViewModel

<input id="@Html.IdFor(m => Model.Value)" aria-label="@Model.AriaLabel" aria- 
required="@Model.AriaRequired" autocomplete="@Model.AutoComplete" 
name="@Html.NameFor(m => Model.Value)" class="@Model.CssClass" type="text" 
value="@Model.Value" @if (Model.MaxLength > 0) { <text> 
maxlength="@Model.MaxLength" </text> } placeholder="@Model.PlaceholderText" 
data-sc-tracking="@Model.IsTrackingEnabled" data-sc-field-name="@Model.Name" 
@Html.GenerateUnobtrusiveValidationAttributes(m => m.Value) />
<label for="@Html.IdFor(m => Model.Value)" 
class="@Model.LabelCssClass">@Html.DisplayTextFor(t => Model.Title)</label>
    @Html.ValidationMessageFor(m => Model.Value, "", new { @class = "sc-form- 
   validation" })
  • Could you please add code as well, which you have done? – Swati Gupta Apr 27 '20 at 17:50
  • @SwatiGupta. Model and view added. – SeeSharper Apr 27 '20 at 19:45

I was also facing the same issue. In core DB, property editor settings - binding configuration, the model property should be in camel case. Once I added the model property in camel case, the issue was fixed. In you case, ariaLabel, ariaRequired etc

enter image description here


Can you please try to add autocomplete value in code db like below:

enter image description here

  • Yes. I already have autocomplete there. – SeeSharper Apr 29 '20 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.