Asp.Net MVC Dropdown and Textbox Validation with Jquery

Using Asp.Net MVC with Jquery and Chosen plugin. I want to get validation for 3 dropdowns and one textbox. Script works for 2 dropdowns but if one of them not chosen, script fails.

And i don’t figure out how to add textbox validation when textbox null with this script. All helps will be appreciated.

View part:

<td>@Html.DropDownListFor(model => model.First,(SelectList)ViewBag.First, "---SEÇİNİZ---", new { @class ="chzn-select" })</td>

<td>@Html.DropDownListFor(model => model.Second, (SelectList)ViewBag.Second, "---SEÇİNİZ---", new { @class ="chzn-select" })</td>

<td>@Html.DropDownListFor(model => model.Third, (SelectList)ViewBag.Third, "---SEÇİNİZ---", new { @class = "chzn-select" })</td>

<td>@Html.TextBoxFor(model => model.Fourth)</td>

My MVC button with helper(button triggers isItValid())

   <td>@Html.Buton("Controller", "Action", "ButtonName", "Name", "Id", "return isItValid()")</td>



    function isItValid() {
        var droplar = document.getElementsByClassName('chzn-select');
        var deger;
        var x = droplar[0].options[droplar[0].selectedIndex].text;

        for (var i = 0; i < droplar.length; i++) {
            var elementValue = droplar[i].options[droplar[i].selectedIndex].value

            if (!elementValue) {
                droplar[i].style.border = "1px solid red";
                deger = false;
            else {
                droplar[i].style.border = "1px solid #e5e5e5";

                deger = true;

        if (!deger) {

            $("<div>Değer Seçiniz</div>").dialog();

            return false;
        else {
            return true;




validation on mvc dropdown values?

I have created 5 dropdowns in mvc razor view using foreach. I need to do validation if same value gets selected in more than one dropdown in jquery. I can easily do it using the dropdown id but what i

MVC3 Conditional Jquery Validation w/ Dropdown

I been trying to do some jquery validation where a textfield or dropdown is validated only if a checkbox is checked. Here is what I have: @using (Ajax.BeginForm(SomeAction, SomeController, new { i

fill data in dropdown box as per previous dropdown box data selected in aspnet mvc 1

i’m buildin’ an employee registration form in aspnet mvc, i have fields like School list in 1 dropdown box and Department list another, problem is i want to show Department list on change of Schoo mvc jquery dropdown validation

how i can validate dropdownlist with unobtrusive javascript ? As its validating textbox for required validator , but its not working for dropdownlist ? Need to change unobtrusive js file for it ? or i

Unobtrusive dropdown validation in MVC 3

So the link below outlines a problem with MVC 3 / unobtrusive validation with dropdown lists. Essentially client side validation script is not emitted for dropdown lists. Is there a straightforward wo

dropdown-textbox using jquery

is there any jquery plugin which provides an dropdown-textbox functionality? something similar to In this example he is making use of ul and li items.. b

Jquery scripts order in ASPNET MVC 4 application

I’m working on an ASPNET MVC 4 project with jqgrid. There, ASPNET MVC 4 puts by default @Scripts.Render(~/bundles/jquery) in _Layout.cshtml file at the end of it. Now, I have a Index.cshtml which

MVC Required Textbox with JQuery DatePicker

I have an MVC form that has 3 required fields. A Name textbox, a Dropdown list and a textbox with the JQuery DatePicker attached to it. If the form is submitted and there is nothing selected, the form

Dropdown validation in JQuery

Actually I am a new user of LAMP(Linux, Apache, Mysql, PHP). I have created a web page using php scripts and have used sort of validation rules by js validation plugin to validate form inputs (textbox

dynamic textbox validation using jquery

I am having dynamic text box in my form . I like to validate using bassistance jquery plugin. My textbox name is in array formate sett