I try to use the jQuery Validation Unobtrusive Native with bootstrap and ASP:NET MVC 5 (https://github.com/johnnyreilly/jQuery.Validation.Unobtrusive.Native)
All validation work fine (textbox, textarea, checkbox) except for dropdownlist multiselect. This is my model:
public class Register
[Display(Name = "Languages")]
[Required(ErrorMessage = "Please select a langauge")]
public List<int> SelectedLanguages { get; set; }
public List<Language> Languages { get; set; }
and this my view
<div class="form-group">
@Html.LabelFor(m => m.SelectedLanguages, new { @for = "submit-languages" })
@Html.DropDownListFor(m => m.SelectedLanguages, true, new SelectList(Model.Languages, "Id", "Name"), htmlAttributes: new { @id = "submit-languages", @multiple = "multiple", @title = "-" })
</div>
the html generated is:
<select class="input-validation-error" data-msg-required="Please select a langauge" data-rule-required="true" id="submit-languages" multiple="multiple" name="SelectedLanguages" title="-" aria-required="true" style="display: none;">
<option value="1">Italian</option>
<option value="2">French</option>
<option value="3">German</option>
<option value="4">Spanish</option>
<option value="5">Russian</option>
<option value="6">Arabic</option>
<option value="7">Ukrainian</option>
</select>
but the validation message does not appear...