This project is read-only.

Dynamic form element are not posted

Topics: Administration, Core, Customizing Orchard, General
Aug 4, 2015 at 8:15 AM
I am developing a form where in a user can add multiple items(dynamic elements).Values are not binded to the DriverResult's Editor function. Looks like I am missing something. Below is my code snippet.
public class UsedEquipmentPropertiesViewModel
    public UsedEquipmentPropertiesViewModel()
        if (UsedEquipmentPropertyList == null)
            UsedEquipmentPropertyList = new List<UsedEquipmentPropertyViewModel>();
    public int ProviderId { get; set; }
         public List<UsedEquipmentPropertyViewModel> UsedEquipmentPropertyList { get; set; }
public class UsedEquipmentPropertyViewModel
    public string Name { get; set; }
    public string CodeName { get; set; }
    public bool IsRequired { get; set; }

Driver class:
public class UsedEquipmentPropertyPartDriver:ContentPartDriver<UsedEquipmentPropertyPart>
protected override string Prefix
            return "UsedEquipmentProperty";
protected override DriverResult Editor(UsedEquipmentPropertyPart part, dynamic shapeHelper)
        return ContentShape("Parts_UsedEquipmentProperty_Edit", () =>
            var viewModel = new UsedEquipmentPropertiesViewModel()

            viewModel.serializedUsedEquipmentPropertyList = JsonConvert.SerializeObject(viewModel.UsedEquipmentPropertyList, Formatting.Indented);
            return shapeHelper.EditorTemplate(TemplateName: "Parts/UsedEquipmentProperty", Model: viewModel, Prefix: Prefix);

Passing ViewModel in shape:

protected override DriverResult Editor(UsedEquipmentPropertyPart part, Orchard.ContentManagement.IUpdateModel updater, dynamic shapeHelper)
        var viewModel = new UsedEquipmentPropertiesViewModel();

        updater.TryUpdateModel(viewModel, Prefix, null, null);
        return null;
        //return Editor(part, shapeHelper);
I have set up the elements as seen in firebug

Name: <input type="text" class="text ng-pristine ng-valid" ng-model="property.Name" name="UsedEquipmentPropertyList[0].Name">
        Code Name:<input type="text" class="text ng-pristine ng-valid" placeholder="Construction Sales" ng-model="property.CodeName " name="UsedEquipmentPropertyList[0]CodeName">
        <input type="checkbox" ng-model="property.IsRequired " name="UsedEquipmentPropertyList[0].IsRequired " class="ng-pristine ng-valid">
I went through this blog post as well : .
Please let me know If I am missing something here .