Materialize CSS – Select List Validation-open source projects Dogfalo/materialize
When trying to use a third party jQuery Validation Library with Materialize I am unable to validate any Select Lists. I was wondering if anyone is able to or knows how to get jQuery.validation working with Materialize?
@Html.DropDownListFor(model =>model.Gender,Models.StaticLists.GenderListItems(), new { @class = "validate[required]", required = "required", Name="Gender"})
Gender:*
This will render out to:
Female
Male
Gender:*
Towards the end of the body the ul-li list gets rendered:
The script that I am using will do:
$('select').material_select();
$('.select-wrapper input').attr("required", "required").each(function (index, item) {
$selectSibling = $(item).siblings('select');
$(item).attr("id", "material" + $selectSibling.attr("id"));
$(item).attr("name", "material" + $selectSibling.attr("name"));
}).addClass("required");
$("#registerForm").validate({
rules:{
materialGenderType:{
required: true
}
}
});
The result of submitting the form is that all of my other form fields that are required and not filled out successfully validate. Nothing occurs and no errors are displayed with the Select Lists. This provided code is a small example of the functionality that I am trying to provide on my form. I wont get into having two lists with the same elements at this time.
Thank you, -Corey