September 9, 2008 – 9:26 am
// type is the dropdown that controls what get displayed.
// folder_drop, radiologist_drop, and resend_box
// get displayed based on the selected value of type.
// This mapping is done in the if/else statements.
// The first time is for when the page loads,
// the second time is when type changes.
//
// The mapping to selected values and id should be put
// into a function so you would only need to change it
// in one place.
function hide_all() {
$("#folder_drop").hide();
$("#radiologist_drop").hide();
$("#resend_box").hide();
}
$(document).ready(function() {
hide_all();
if($("#type").val().indexOf("Folder") != -1) {
$("#folder_drop").show();
}
else if($("#type").val().indexOf("Radiologist") != -1) {
$("#radiologist_drop").show();
}
else if($("#type").val().indexOf("ReSend") != -1) {
$("#resend_box").show();
}
$("#type").change(function(){
hide_all();
if($(this).val().indexOf("Folder") != -1) {
$("#folder_drop").show();
}
else if($(this).val().indexOf("Radiologist") != -1) {
$("#radiologist_drop").show();
}
else if($(this).val().indexOf("ReSend") != -1) {
$("#resend_box").show();
}
});
}
);