holty
07-01-2002, 09:55 AM
All,
Some time ago i worked (with help from Dave Clark) on some code to enable 3 combo boxes when 'Yes' was selected from a combo box, i.e - you have a combo with yes or no - if yes was selected the 3 combo's would be enabled (3 combos are for the date). I would like to modify this now so that when a checkbox is checked it will enable the combo's.
Here is the code that i have editted but cannot get to work - please note that the number of checkbox's are not static.
<script language="Javascript">
function checkDisabled(ele, grp) {
var frm = ele.form;
if (ele.selectedIndex==1) {
frm.cboDateDay[grp].disabled=false;
frm.cboDateMonth[grp].disabled=false;
frm.cboDateYear[grp].disabled=false;
} else {
frm.cboDateDay[grp].disabled=true;
frm.cboDateMonth[grp].disabled=true;
frm.cboDateYear[grp].disabled=true;
}
return true;
}
</script>
<% if not rsOnArrivalDetails.EOF then
intCount=0
Do while not rsOnArrivalDetails.EOF %>
<tr>
<INPUT type="hidden" name="UpdateOnArrivalID" value="<%=rsOnArrivalDetails("OnArrivalID")%>">
<td width="50%" bgcolor="#F5F5F5"><%=rsOnArrivalDetails("Description")%></td>
<td width="10%" bgcolor="#F5F5F5"><center>
<input type="checkbox" name="chkNotifyUpdate" disabled value="<%=rsOnArrivalDetails("OnArrivalID")%>" checked></td></center>
<td width="10%" bgcolor="#F5F5F5"><center>
<% if rsOnArrivalDetails("Confirmation") = true then %>
<input type="checkbox" name="chkConfirmUpdate" disabled value="<%=rsOnArrivalDetails("OnArrivalID")%>" checked ></center>
<% else %>
<input type="checkbox" name="chkConfirmUpdate" value="<%=rsOnArrivalDetails("OnArrivalID")%>" onChange="return checkDisabled(this, <%=intCount%>)" ;></center>
<% end if %>
</td>
<td width="30%">
<select name="cboDateDay" disabled>
<option value="">
<% For i = 01 to 31 %>
<option value="<%=i%>"><%=i%></option>
<% Next %>
</select>
</select>
<select name="cboDateMonth" disabled>
<option value="">Please Select</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select name="cboDateYear" disabled>
<%CurrentYear = Year(Date)%>
<option value="">
<option value="<%=CurrentYear - 1%>"><%=CurrentYear - 1%></option>
<option value="<%=CurrentYear%>"><%=CurrentYear%></option>
<option value="<%=CurrentYear + 1%>"><%=CurrentYear + 1%></option>
</select>
</font></td>
</tr>
<%
'move through recordset retrieving all rows
rsOnArrivalDetails.MoveNext
intCount=intCount+1
Loop
If anyone can spot what i am doing wrong then please say!
Some time ago i worked (with help from Dave Clark) on some code to enable 3 combo boxes when 'Yes' was selected from a combo box, i.e - you have a combo with yes or no - if yes was selected the 3 combo's would be enabled (3 combos are for the date). I would like to modify this now so that when a checkbox is checked it will enable the combo's.
Here is the code that i have editted but cannot get to work - please note that the number of checkbox's are not static.
<script language="Javascript">
function checkDisabled(ele, grp) {
var frm = ele.form;
if (ele.selectedIndex==1) {
frm.cboDateDay[grp].disabled=false;
frm.cboDateMonth[grp].disabled=false;
frm.cboDateYear[grp].disabled=false;
} else {
frm.cboDateDay[grp].disabled=true;
frm.cboDateMonth[grp].disabled=true;
frm.cboDateYear[grp].disabled=true;
}
return true;
}
</script>
<% if not rsOnArrivalDetails.EOF then
intCount=0
Do while not rsOnArrivalDetails.EOF %>
<tr>
<INPUT type="hidden" name="UpdateOnArrivalID" value="<%=rsOnArrivalDetails("OnArrivalID")%>">
<td width="50%" bgcolor="#F5F5F5"><%=rsOnArrivalDetails("Description")%></td>
<td width="10%" bgcolor="#F5F5F5"><center>
<input type="checkbox" name="chkNotifyUpdate" disabled value="<%=rsOnArrivalDetails("OnArrivalID")%>" checked></td></center>
<td width="10%" bgcolor="#F5F5F5"><center>
<% if rsOnArrivalDetails("Confirmation") = true then %>
<input type="checkbox" name="chkConfirmUpdate" disabled value="<%=rsOnArrivalDetails("OnArrivalID")%>" checked ></center>
<% else %>
<input type="checkbox" name="chkConfirmUpdate" value="<%=rsOnArrivalDetails("OnArrivalID")%>" onChange="return checkDisabled(this, <%=intCount%>)" ;></center>
<% end if %>
</td>
<td width="30%">
<select name="cboDateDay" disabled>
<option value="">
<% For i = 01 to 31 %>
<option value="<%=i%>"><%=i%></option>
<% Next %>
</select>
</select>
<select name="cboDateMonth" disabled>
<option value="">Please Select</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select name="cboDateYear" disabled>
<%CurrentYear = Year(Date)%>
<option value="">
<option value="<%=CurrentYear - 1%>"><%=CurrentYear - 1%></option>
<option value="<%=CurrentYear%>"><%=CurrentYear%></option>
<option value="<%=CurrentYear + 1%>"><%=CurrentYear + 1%></option>
</select>
</font></td>
</tr>
<%
'move through recordset retrieving all rows
rsOnArrivalDetails.MoveNext
intCount=intCount+1
Loop
If anyone can spot what i am doing wrong then please say!