Skip to content

ExistsIn doesn't work with list model or sub-properties without duplicating the lookup on the parent model #131

@fsateler

Description

@fsateler

Actually, I have not tested if submodels work. But in list models it doesn't:

@model IList<MyModel>
// Snip form and section...
for (int i = 0; i < Model.Count; i++) { 
        @s.FieldFor(m => model.Category).AsDropDown()
}

class MyModel {
    [ExistsIn("Categories""Item1", "Item1")] public string Category {get;set;}
    public List<Tuple<string>> Categories { get; set; }
}

This throws an exception:

ExistsIn: No property Model.Categories exists for looking up values for property Model.Category.

The problem is that ChameleonForms tries to lookup the referenced value from ExistsIn in the IList model, which of course doesn't exist.

This is version 1.2.0 from nuget.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions