How to check a dropdown list in mvc 4.5?

I work with mvc

in framework-4.5

. All other areas check if it works correctly, but I'm having a hard time picking the dropdownlist. Validation works correctly in a simple dropdown list as well. I tried to show the message using field validation and I / O validation error, but with no success. Here are some of the changes I made to jquery.validate.unobtrusive.js

.

function onError(error, inputElement) {  // 'this' is the form element

    var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
    replaceAttrValue = container.attr("data-valmsg-replace"),
    replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
    container.removeClass("field-validation-valid").addClass("field-validation-error");
    error.data("unobtrusiveContainer", container);
    if (replace) {
        container.empty();
        error.removeClass("input-validation-error-+-").appendTo(container);
    }
    else {
        error.hide();
    }
    //For Validation Toggel Start 
    debugger;

    if ($(inputElement).parent().hasClass("selectize-input")) {
        $(inputElement).parent().parent().parent().addClass("md-input-danger");
        var container = error.data("unobtrusiveContainer");
        container.removeClass("field-validation-valid").addClass("field-validation-error");
    }       
}

      

I did a lot of research for this, but I didn't get the right solution.

please help me to solve this problem. Thanks to

+3


source to share





All Articles