Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

The auto suggestion editor has required validation even when there is no required attribute on the model

Found in

EPiServer.CMS.UI 7.10.0

Created

Jul 22, 2014

Updated

Aug 08, 2014

Area

Falcon/CMS/Edit UI

State

Closed, Fixed and Tested


Steps to reproduce

1. Add the following class to the project.

[ServiceConfiguration(typeof(ISelectionQuery))]
public class MyCustomItemQuery : ISelectionQuery
{
    private readonly SelectItem[] _items;

    public MyCustomItemQuery()
    {
        _items = new[]
        {
            new SelectItem { Text = "OneTwoThree", Value = "123" },
            new SelectItem { Text = "TwoThreeFour", Value = "234" }
        };
    }

    public IEnumerable<ISelectItem> GetItems(string query)
    {
        return _items.Where(i => i.Text.StartsWith(query));
    }

    public ISelectItem GetItemByValue(string value)
    {
        return _items.FirstOrDefault(i => i.Value.Equals(value));
    }
}



2. Add the following property and attribute to a page content type.

[AutoSuggestSelection(typeof(MyCustomItemQuery))]
public virtual string TestProperty { get; set; }



3. Create a page of that content type
4. Go to all properties mode
5. Give the test property focus
6. Remove focus from the test property

Observed: The property displays a required validation error.
Expected: No validation error since the property is not marked as required on the model.