Open Tsukasa42 opened 7 years ago
There seems to be an issue where validation isn't added. This is a partial view being dynamically added.
This view works, data-val and data-val-required are added correctly.
`
Now when I attempt the following data-val and data-val-required are not added
`@using (var f = Html.Bootstrap().Form("Upsert", "Inventory", FormMethod.Post).AddAttribute("autocomplete", "off").AddAttribute("data-result", "json-alert").Begin()) { @Html.AntiForgeryToken() @f.HiddenFor(x => x.Inventory.ID)
<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="modalPopupLabel">Inventory Details</h4> </div> <div class="modal-body"> @using (var row = Html.Bootstrap().GridRow().Begin()) { using (var g1 = row.GridColumn(6).Begin()) { @f.SelectFor(x => x.Inventory.EntryTypeID).AddOption(null).AddOptions(Model.EntryTypeDropdown).SetControlLabel(null).SetSize(InputSize.Sm).AddAttribute("data-role", "selectize").AddAttribute("placeholder", "Item Status") @f.SelectFor(x => x.Inventory.DeviceTypeID).AddOption(null).AddOptions(Model.DeviceTypeDropdown).SetControlLabel(null).SetSize(InputSize.Sm).AddAttribute("data-role", "selectize").AddAttribute("placeholder", "Device Type") @f.InputFor(x => x.Inventory.AssetTag).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Asset Tag").AddCss("text-uppercase").AddAttribute("maxlength", "7").AddAttribute("data-input-mask", "assettag").SetReadonly(Model.IsEditable) @f.InputFor(x => x.Inventory.Make).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Make").AddCss("text-uppercase").SetReadonly(Model.IsEditable) @f.InputFor(x => x.Inventory.Model).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Model").AddCss("text-uppercase").SetReadonly(Model.IsEditable) @f.InputFor(x => x.Inventory.SerialNumber).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Serial Number").AddCss("text-uppercase").SetReadonly(Model.IsEditable) @f.TextAreaFor(x => x.Inventory.Comments).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Comments") } using (var g1 = row.GridColumn(6).Begin()) { @f.InputFor(x => x.Inventory.DeviceName).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Device Name").AddCss("text-uppercase") @f.SelectFor(x => x.Inventory.CenterID).AddOption(null).AddOptions(Model.CenterTypeDropdown).SetControlLabel(null).SetSize(InputSize.Sm).AddAttribute("data-role", "selectize").AddAttribute("placeholder", "Center") @f.SelectFor(x => x.Inventory.DepartmentID).AddOption(null).AddOptions(Model.DepartmentTypeDropdown).SetControlLabel(null).SetSize(InputSize.Sm).AddAttribute("data-role", "selectize").AddAttribute("placeholder", "Department") @f.InputFor(x => x.Inventory.Location).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Location") @f.InputFor(x => x.Inventory.StaticIP).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Static IP").AddAttribute("data-input-mask", "ip") @f.InputFor(x => x.Inventory.Username).SetControlLabel(null).SetSize(InputSize.Sm).SetPlaceholder("Username") } }`
Also another odd thing happening is when the validation issue is present, the lists are not selecting the value that is passed with the model.
Some sort of binding issue since both validation and select list selections aren't set properly?
There seems to be an issue where validation isn't added. This is a partial view being dynamically added.
This view works, data-val and data-val-required are added correctly.
`
Inventory Details
Now when I attempt the following data-val and data-val-required are not added
`@using (var f = Html.Bootstrap().Form("Upsert", "Inventory", FormMethod.Post).AddAttribute("autocomplete", "off").AddAttribute("data-result", "json-alert").Begin()) { @Html.AntiForgeryToken() @f.HiddenFor(x => x.Inventory.ID)
Also another odd thing happening is when the validation issue is present, the lists are not selecting the value that is passed with the model.
Some sort of binding issue since both validation and select list selections aren't set properly?