I want to ensure that when I check a certain box then another checkbox will be checked and unable to uncheck unless the master checkbox is deselected. When the ECOM checkbox is checked the 3d secure checkbox is automatically checked and cannot be unchecked until the Ecom box is deselected.
<%
If Request.QueryString("ECOM") = "ON" Then
Apply_ECOM_Check.Checked = True
End if
If Request.QueryString("MOTO") = "ON" Then
Apply_MOTO_Check.Checked = True
End if
If Request.QueryString("TERMINAL") = "ON" Then
Apply_TERMINAL_Check.Checked = True
End if
If Apply_ECOM_Check.Checked = False and Apply_MOTO_Check.Checked = False and Apply_TERMINAL_Check.Checked = False then
Apply_ECOM_Check.Checked = True
End if
%>
<script type="text/javascript">
function enableaddonservice() {
var ecom =document.getElementById("Apply_ECOM_Check").checked;
var moto =document.getElementById("Apply_MOTO_Check").checked;
var terminal =document.getElementById("Apply_TERMINAL_Check").checked;
if (ecom==true ) {
document.getElementById("addonservices").style.display = "block";
} else {
document.getElementById("addonservices").style.display = "none";
}
}
var chk1 = $('#Apply_ECOM_Check');
var chk2 = $('#Apply3DSecure');
//check the other box
chk1.on('click', function(){
if( chk1.is(':checked') ) {
chk2.attr('checked', true);
} else {
chk2.attr('checked', false);
}
});</script>
<input class="noborder" type="checkbox" ID="Apply_ECOM_Check" name="Apply_ECOM_Check" runat="server" style="width: 18px" value="ON" onClick="enableaddonservice();" /> ECOM
<input class="noborder" type="checkbox" ID="Apply_MOTO_Check" name="Apply_MOTO_Check" runat="server" style="width: 18px" value="ON" onClick="enableaddonservice();" /> MOTO
<input class="noborder" type="checkbox" ID="Apply_TERMINAL_Check" name="Apply_TERMINAL_Check" runat="server" style="width: 18px" value="ON" onClick="enableaddonservice()" /> TERMINAL
Once Ecom is selected above then the 3d secure below is automatically selected and can not be removed unless ecom is deselected
<table style="width: 100%">
<tr>
<td><input class="noborder" type="checkbox" ID="Apply3DSecure" name="Apply3DSecure" runat="server" style="width: 18px" /> 3D Secure </td>
<td> <input class="noborder" type="checkbox" ID="Apply_Mobilepaypage" name="Apply_Mobilepaypage" runat="server" style="width: 18px" /> Mobile PayPage </td>
<td> <input class="noborder" type="checkbox" ID="Apply_RepeatPayments" name="Apply_RepeatPayments" runat="server" style="width: 18px" /> Repeat Payments </td>
</tr>
The Java script works on it's own with the check boxes but because the 3d secure selection addon is only displayed when Ecom is selected. I think that interferes. I have tried many functions in these check boxes and it will not do anything.