Hello,
I have a form that is used to input attendance. The attendance field is a cfselect from which the user chooses if the student was: present, absent, etc. There is also a comment field that is required to be completed for each student based upon their behavior in that class. If the student was absent, I would like to poplulate the comment box with the simple expression: Absent. That way the user does not have to enter a required comment for that person.
The relevant code in the form is as follows. The name of each control is variable based on the student id number. I'm not sure the correct way to go about trying to get the value of Absent to display in the textarea if Absent is selected for the attendance.
<cfoutput query="qryGetGroupMembers">
<tr><!--- One row for each scheduled student in the table --->
<td colspan="10">#last_name#, #first_name#</td>
<td><strong>Attendance Code:</strong>
<cfselect name="Att#idnum#" query="GetAttendance" value="Att_code" selected="T"
size="1" display="Att_desc" multiple="No" onChange="fnAttCode(this.value)" >
</cfselect><br><br>
</td>
<td align="left">
<strong>Comments</strong> (<font color="##FF0000"><strong>REQUIRED</strong></font>): <br />
<cftextarea name="txt#idnum#" required="yes" rows="4" cols="35" message="Please enter a comment for #last_name#, #first_name#"/>
</td>
</tr>
</cfoutput>
<script language="JavaScript">
function fnAttCode(val){
var code = val
if (code == 'A'){
document.getElementById('txt#cnum#').innerHTML ="Absent"
}
}
</script>
Hope this makes some sense. Thank you for any help that you can provide. I do not know Javascript and found the above example of code based on searching online.
Lisa
I have a form that is used to input attendance. The attendance field is a cfselect from which the user chooses if the student was: present, absent, etc. There is also a comment field that is required to be completed for each student based upon their behavior in that class. If the student was absent, I would like to poplulate the comment box with the simple expression: Absent. That way the user does not have to enter a required comment for that person.
The relevant code in the form is as follows. The name of each control is variable based on the student id number. I'm not sure the correct way to go about trying to get the value of Absent to display in the textarea if Absent is selected for the attendance.
<cfoutput query="qryGetGroupMembers">
<tr><!--- One row for each scheduled student in the table --->
<td colspan="10">#last_name#, #first_name#</td>
<td><strong>Attendance Code:</strong>
<cfselect name="Att#idnum#" query="GetAttendance" value="Att_code" selected="T"
size="1" display="Att_desc" multiple="No" onChange="fnAttCode(this.value)" >
</cfselect><br><br>
</td>
<td align="left">
<strong>Comments</strong> (<font color="##FF0000"><strong>REQUIRED</strong></font>): <br />
<cftextarea name="txt#idnum#" required="yes" rows="4" cols="35" message="Please enter a comment for #last_name#, #first_name#"/>
</td>
</tr>
</cfoutput>
<script language="JavaScript">
function fnAttCode(val){
var code = val
if (code == 'A'){
document.getElementById('txt#cnum#').innerHTML ="Absent"
}
}
</script>
Hope this makes some sense. Thank you for any help that you can provide. I do not know Javascript and found the above example of code based on searching online.
Lisa