如何验证jquery中的下拉列表

时间:2016-02-06 05:26:48

标签: javascript jquery drop-down-menu

我有级联下拉列表显示report.its工作正常,但第二次下拉列表显示第一个下拉报告,然后是第二个下拉报告,并继续其他下拉列表。

我认为如果条件一直变为现实,那么我将收到所有

的报告

请告诉我们错了:

 $("#SearchDialog").dialog({
        resizable: false,
        autoOpen: false,
        width: 450,
        height: 'auto',
        show: 'blind',
        hide: 'blind',
        position: { my: "right top", at: "right top", of: window },
        buttons: {
            "Search": function () {

                var selected = $('#SearchDialogTabs').tabs('option', 'active');
                //var filter = "";

                if (selected == 0) {
                    var DistrictName = $('#ddlDistrict').val();
                    var TalukName = $('#ddlTaluk').val();
                    var HobliName = $('#ddlHobli').val();
                    var VillageName = $('#ddlVillage').val();

                    if ((DistrictName.length != 0) && (TalukName = '-- Select --')) {



                        if (($('#ddlDistrict').val() == '-- Select --')) {
                            alert("Please Select District");
                            $("#SearchDialogTabs").tabs({ selected: 0 });
                            $("#SearchDialog").dialog('open');
                        }

                        GetDistrictReport($('#ddlDistrict>option:selected').val());

                    }


                    if ((DistrictName.length != 0) && (TalukName = $('#ddlTaluk').val()) && (HobliName = '-- Select --')) {

                        if (($('#ddlTaluk').val() == '-- Select --')) {
                            alert("Please Select Taluk");
                            $("#SearchDialogTabs").tabs({ selected: 0 });
                            $("#SearchDialog").dialog('open');
                        }


                        GetTalukReport($('#ddlTaluk>option:selected').val());

                    }



                    if (($('#ddlHobli').val() == '-- Select --')) {
                        alert("Please Select Hobli");
                        $("#SearchDialogTabs").tabs({ selected: 0 });
                        $("#SearchDialog").dialog('open');
                    }

                    if ((DistrictName.length != 0) && (TalukName.length != 0) && (HobliName.length != 0)) {
                        GetHobliReport($('#ddlHobli>option:selected').val());
                    }


                    if (($('#ddlVillage').val() == '-- Select --')) {
                        alert("Please Select Village");
                        $("#SearchDialogTabs").tabs({ selected: 0 });
                        $("#SearchDialog").dialog('open');
                    }

                    if ((DistrictName.length != 0) && (TalukName.length != 0) && (HobliName.length != 0) && (VillageName.length != 0)) {
                        GetVillageReport($('#ddlVillage>option:selected').val());
                    }
                }                 

        },
          Cancel: function () {
                $(this).dialog("close");
            }
    });

0 个答案:

没有答案