onclick - Why does R# tell me, "Not all code paths return a value" in a click handler? -
at end of submit button click handler, resharper warns that, "not code paths return value."
what value expecting event handler?
in deference full disclosure, event handler:
$("#submit_button").click(function() { // http://stackoverflow.com/questions/18192288/how-can-i-compare-date-time-values-using-the-jqueryui-datepicker-and-html5-time var begd = $.datepicker.parsedate('mm/dd/yy', $('#begindate').val()); var endd = $.datepicker.parsedate('mm/dd/yy', $('#enddate').val()); if (begd > endd) { alert('begin date must before end date'); $('#begindate').focus(); return false; } else if (begd.tostring() == endd.tostring()) { var dtestring = begd.getfullyear() + "/" + (begd.getmonth() + 1) + "/" + begd.getdate(); var begt = new date(dtestring + " " + $('#begintime').val()); var endt = new date(dtestring + " " + $('#endtime').val()); if (begt > endt) { alert('begin date must before end date'); $('#begintime').focus(); return false; } } $("#numberofresults").css("visibility", "visible"); $("#numberofresults").html("please wait..."); enablebutton("submit_button", false); // if selected, don't enumerate them; set @ "all" (change of case shows logic did execute) var deptslist = $('#depts').checkedboxes(); if (deptslist.length < deptsarray.length) { $('#deptheader span').html(deptslist.join(", ")); } else if (deptslist.length == deptsarray.length) { $('#deptheader span').html("all"); } // " " var siteslist = $('#sites').checkedboxes(); $('#sitesheader span').html(siteslist.join(", ")); if (siteslist.length < sitesarray.length) { $('#sitesheader span').html(siteslist.join(", ")); } else if (siteslist.length == sitesarray.length) { $('#sitesheader span').html("all"); } $('#hiddendepts').val(deptslist); $('#hiddensites').val(siteslist); var upcs = $('#upc').val(); if (upcs == "all") { $('#upc').val("1"); // take (1 , greater) } var resultstext = jquery.trim($("#spannumberofresults").text()); if (resultstext != "") { $("#numberofresults").css("visibility", "visible"); if (resultstext == "0") { $("#numberofresults").css("color", "red"); } else { var href = '/@configurationmanager.appsettings["thisapp"]/ccrcriteria/loadreport'; // report_parms (sic) referenced loadreport var report_parms = { guid: "@model.guid", serialnumber: "@model.serialnumber", reportname: "@model.reportname" }; window.open(href, "report_window", "resizable=1, width=850, left=" + (screen.width / 2 - 425)); } } }); // end of submit button click
resharper isn't aware of event handlers.
it sees function return false
, won't return anything, , complains.
it doesn't realize pattern fine event handlers.
Comments
Post a Comment