javascript - how to validate dropdown in jquery -


i have cascading dropdown display report.its working fine 2nd dropdown display 1st dropdown report , 2nd dropdown report , continues other dropdowns.

i think if conditions becoming true time getting reports all

please tell whats wrong:

 $("#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");             }     }); 


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -