I have a dynamically generated list of students. I want the users to capture attendance and, if absent, whether it is excused or not. If present, there is no reason to record the latter and I want that option disabled.
My problem is that the list is dynamically generated to include the form elements for taking attendance (via django templates and google app engine).
Im using javascript to enable/disable the excused/unexcused radio buttons but cant figure out a good way to do so. It seems to be a simple matter of correct variable usage but I can’t figure it out (and js is not a language I know super well).
Im trying to attempt the following in the js function:
//bring the name and ID of the clicked element in to the function
function disable_enable(rdoIdIN, rdoNameIN){
//create a simple string of the common portion of the submitting button Im looking for, the word, "absent"
var rdoId = rdoIdIN.substring(0,6);
//use the dynamic portion of the clicked element name to generate the dynamic name of the element I want to enable
var rdoStatusName = 'attendcategory' + rdoNameIN.substring(10)
if (document.formname.rdoID == 'absent'){
//enable the excused/unexcused elements
document.formname.rdoStatusName[0].disabled=false;
document.formname.rdoStatusName[1].disabled=false;
}
It seems like this would be a routine issue in dynamic form content but I have been unsuccessful in finding a solution.
You may use the elements-collection: