I have a switch
statement in my javascript on an ASP.NET C# web application. I am debugging it with FireBug and it is erroring out: as soon as it reaches the switch
it exists it immediately.
Here is the code:
$(function() {
$('#received_dateTextbox').mask("99/99/99");
$('#report_dateTextBox').mask("99/99/99");
$('#occurrence_dateTextBox').mask("99/99/99");
//var checkValues='';
$('table input:checkbox').click(function() {
if ($(this).prop('checked')) {
var checkText = $(this).next('a').text();
var hrefValue = $(this).next('a').attr('href');
var trimIndex = hrefValue.lastIndexOf('\\') + 1;
var checkValue = hrefValue.substr(trimIndex, hrefValue.indexOf("')",trimIndex)-trimIndex);
//checkValues+=checkValue+";";
switch(checkValue)
{
//preanalytical other
case "21":
var userInput = prompt("Other:", "Other:");
$(this).next('a').html('Other:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//analytical other
case "53":
var userInput = prompt("Other:", "Other:");
$(this).next('a').html('Other:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//postanalytical other
case "89":
var userInput = prompt("Other:", "Other:");
$(this).next('a').html('Other:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//other other
case "95":
var userInput = prompt("Other:", "Other:");
$(this).next('a').html('Other:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//analytical liquid handler instrument failure
case "40":
var userInput = prompt("Liquid Handler#:", "Liquid Handler#:");
$(this).next('a').html('Liquid Handler#:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//analytical olympus instrument failure
case "41":
var userInput = prompt("Olympus#:", "Olympus#:");
$(this).next('a').html('Olympus#:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//analytical lcms instrument failure
case "42":
var userInput = prompt("LC-MS/MS#:", "LC-MS/MS#:");
$(this).next('a').html('LC-MS/MS#:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//analytical liquid handler delay prod
case "49":
var userInput = prompt("Liquid Handler#:", "Liquid Handler#:");
$(this).next('a').html('Liquid Handler#:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//analytical olympus delay prod
case "50":
var userInput = prompt("Olympus#:", "Olympus#:");
$(this).next('a').html('Olympus#:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//analytical lcms delay prod
case "51":
var userInput = prompt("LC-MS/MS#:", "LC-MS/MS#:");
$(this).next('a').html('LC-MS/MS#:' + '<font color="red">' + userInput + '</font>');
checkValues+=checkValue+":"+userInput;
break;
//wrong practice code
case "63":
if (confirm("Do you want to check Report Sent to Wrong Location/Physician?"))
{ var elNode = document.getElementById("TreeView1n82CheckBox");
$(elNode).prop("checked", true);
}
else
{ var elNode = document.getElementById("TreeView1n81CheckBox");
$(elNode).prop("checked", false);
}
break;
default:
alert('no match');
}
}
});
//document.getElementById('HiddenField1').value = checkValues;
});
The debugger showed me that checkValue
definitely has a value
What am i doing wrong?
case
'd for? If you adddefault: alert('no match');
to your switch, does the alert show up? – Marc B Oct 27 '11 at 20:58case
values matched. – Marc B Oct 27 '11 at 21:01