I have two tables (#q7 and #q85 are the Table IDs for the Affected Docs and New Docs tables). First, let me provide a little history. When a user checks the "Yes" radio button, it checks the QA Project Support box and disables it so it cannot be changed. This function is working nicely:
Here's the working code for that:
$(document).ready(function(){
//Fills in Output Field with Affected (#q7) and New (#q85) Docs
function populateTextArea(){
var str = '';
// Use the Table ID instead
$('#q7 tbody tr, #q85 tbody tr').each(function(){
if (str != '') str = str+'; ';
var fieldCheck = $(this).find('.docID input').val() || ''; //If input has no value, set to blank and not run through fields.
if (fieldCheck != ''){
str = str+$(this).find('.docID input').val()+'-'+$(this).find('.docNo input').val()+'-'+$(this).find('.revision input').val();
}
});
$('.output textarea').val(str);
}
// q7 and q85 are the Table IDs
$('#q7, #q85').on('change blur', populateTextArea);
$('#q7, #q85').on('click blur', populateTextArea);
//The code below will wait 1 second before triggering the text population. Useful if Table rows are being populated from database.
setTimeout(function(){
populateTextArea(); //Call function
},1000); //End setTimeout
}); //close document.ready
Now for my issue. Using these same two tables, if docIDDescription = Drawing (not Drawing Checkprint, Fabrication Drawing, or Fabrication Drawing Checkprint) in either of these two tables, I need to check the "discipline" boxes and disable them:
Here's what I have so far, but it's not working:
$(document).ready(function(){
//Checks Affected (#q7) and New (#q85) Docs tables for Drawings, if any Doc ID Description = Drawing, per procedure update, all disciplines must review the DCR
function checkDocIDDesc(){
// Use the Table ID instead
$('#q7 tbody tr, #q85 tbody tr').each(function(){
$(this).find('.docIDDesc input').val()
if ($(this).val() == "Drawing")
{
$("#Field104-0").prop("disabled", false); //Enable so it can be changed
$("#Field104-0").prop("checked", true).change(); //Drafting and Design is Required
$("#Field104-0").prop("disabled", true); //Disable so it cannot be changed
$("#Field104-1").prop("disabled", false); //Enable so it can be changed
$("#Field104-1").prop("checked", true).change(); //Nuclear Analysis is Required
$("#Field104-1").prop("disabled", true); //Disable so it cannot be changed
$("#Field104-3").prop("disabled", false); //Enable so it can be changed
$("#Field104-3").prop("checked", true).change(); //Structural Analysis is Required
$("#Field104-3").prop("disabled", true); //Disable so it cannot be changed
$("#Field104-4").prop("disabled", false); //Enable so it can be changed
$("#Field104-4").prop("checked", true).change(); //Thermal Analysis is Required
$("#Field104-4").prop("disabled", true); //Disable so it cannot be changed
}
else
{
$("#Field104-0").prop("disabled", false); //Enable so it can be changed
$("#Field104-1").prop("disabled", false); //Enable so it can be changed
$("#Field104-3").prop("disabled", false); //Enable so it can be changed
$("#Field104-4").prop("disabled", false); //Enable so it can be changed
}
}
// q7 and q85 are the Table IDs
$('#q7, #q85').on('change blur', checkDocIDDesc);
$('#q7, #q85').on('click blur', checkDocIDDesc);
//The code below will wait 1 second before triggering the function.
setTimeout(function(){
checkDocIDDesc(); //Call function
},1000); //End setTimeout
}); //close document.ready
Any assistance would be greatly appreciated!