Solved

toggle checkboxes when a checkbox is checked

Posted on 2016-08-22
16
65 Views
Last Modified: 2016-08-22
I am using ASP/bootrap/ javascript or jquery.

I need a checkbox to toggle a bunch of other checkboxes if the master checkbox is checked or unchecked.

My master checkbox code is:

<input name="selectall" type="checkbox" id="selectall" value="1"/>

Open in new window


This are examples of two checkboxes I want to 'check' or 'uncheck' based on the behavior or the above checkbox.

<div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSQnr").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSQnr" type="checkbox" id="CMSQnr" value="1"/>
                      </div>
                    </div>


<div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSContacts").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSContacts" type="checkbox" id="CMSContacts" value="1"/>
                      </div>
                    </div> 

Open in new window


There are plenty more but an example with two will do.
0
Comment
Question by:amucinobluedot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
16 Comments
 
LVL 9

Expert Comment

by:James Bilous
ID: 41765967
Assign the checkboxes you want to check a class and check them in the on change event of the selectall checkbox

$("#selectall").change(function() {
    if(this.checked) {
        $(".someCheckboxClass").prop("checked", true);
    }
});

Open in new window

0
 

Author Comment

by:amucinobluedot
ID: 41765979
I added this code at the bottom

  $("#selectall").change(function() {
    if(this.checked) {
        $(".chkfill").prop("checked", true);
    }
});

Open in new window


I checked the selectall checkbox but nothing happened

and I changed the code for one of my checkboxes

<div class="col-sm-10">
                      <div class="i-checks chkfill">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSQnr").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSQnr" type="checkbox" id="CMSQnr" value="1"/>
                      </div>
                    </div>

Open in new window

0
 
LVL 9

Expert Comment

by:James Bilous
ID: 41765983
The class chkfill needs to be on the checkbox inputs themselves, not on the surrounding div.
0
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 

Author Comment

by:amucinobluedot
ID: 41765984
Tried that too

 <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSQnr").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSQnr" type="checkbox" id="CMSQnr" value="1" class="chkfill"/>
                      </div>

Open in new window


No luck.
0
 
LVL 9

Expert Comment

by:James Bilous
ID: 41765986
Do you see any javascript errors? You have jQuery installed right?
0
 

Author Comment

by:amucinobluedot
ID: 41765993
I do. I have other scripts on the same page, those run fine.
Below is the full code, maybe you can spot something I may be missing.

<html>
<head>
<!--#head includes-->
<!--#include file="../includes/bdot/headlevel1.asp"-->
</head>

<!-- Body -->
<body>

<div id="wrapper">



<div id="page-wrapper" class="gray-bg">
	<div class="row border-bottom">
</div>
        
<!-- Content starts-->
  <form name="form1" action="<%=MM_editAction%>" method="POST" class="form-horizontal" id="form1">
    <div class="wrapper wrapper-content animated fadeIn" style="animation-delay: 0.4s;">
      <div class="row">
        <div class="col-lg-12">
          <div class="ibox float-e-margins">
            <div class="ibox-title">
              <h5>Users</h5>
              &nbsp;|&nbsp; Access rights for <%=(rs_user.Fields.Item("Mailstr").Value)%>&nbsp;<%=(rs_user.Fields.Item("MaidenNm").Value)%></div>
            <div class="ibox-title"><button type="submit" class="btn btn-primary" >Save changes</button>&nbsp;<a href="company_users.asp" class="btn btn-white">Cancel</a>&nbsp;<a href="company_users_spresetpass.asp?newuserloginid=<%=(rs_userlogin.Fields.Item("userloginid").Value)%>" class="btn btn-white btn-sm2">Reset password</a>&nbsp;<a href="company_users_spdeletepass.asp?loginid=<%=(rs_userlogin.Fields.Item("userloginid").Value)%>" class="btn btn-warning btn-sm1"> Delete password </a></div>
            <div class="ibox-content">
             
              <table class="table table-hover">
                <tbody>
                 <tr>
                    <td class="alert-warning">Permissions</td>
                    <td class="alert-warning">&nbsp;</td>
                    <td class="alert-warning">Check all</td>
                    <td class="alert-warning">
                    <div class="form-group">
                      <div class="col-sm-10">
                        <div class="i-checks">
                          <input name="selectall" type="checkbox" id="selectall" value="1"/>
                        </div>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td width="14%">Username</td>
                    <td width="36%"><div class="form-group">
                      <div class="col-sm-10"><%=(rs_userlogin.Fields.Item("LoginId").Value)%></div></div></td>
                    <td width="14%">Support license</td>
                    <td width="36%">
                    <% If Not rs_maxlicenses.EOF Or Not rs_maxlicenses.BOF Then %>
  <div class="form-group">
                      <div class="col-sm-10">
                        <div class="i-checks">
                          <input <%If (CStr((rs_userlogin.Fields.Item("supplicense").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="supplicense" type="checkbox" id="supplicense" value="1"/>
                        </div>
                      </div>
                    </div>
                     <% End If ' end Not rs_maxlicenses.EOF Or NOT rs_maxlicenses.BOF %>
                <% If rs_maxlicenses.EOF And rs_maxlicenses.BOF Then %>
                  maximum number of support licenses reached
                  checkbox blank here
<% End If ' end rs_maxlicenses.EOF And rs_maxlicenses.BOF %>


                  </td>
                  </tr>
                  <tr>
                    <td>Login start time</td>
                    <td><div class="form-group">
                      <div class="col-sm-10">
                        <select name="loginstartime" size="1" class="form-control m-b" id="loginstartime">
                          <option value="08:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("08:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>8:00 am</option>
                          <option value="09:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("09:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>9:00 am</option>
                          <option value="10:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("10:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>10:00 am</option>
                          <option value="11:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("11:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11:00 am</option>
                          <option value="12:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("12:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>12:00 pm</option>
                          <option value="13:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("13:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>1:00 pm</option>
                          <option value="14:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("14:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2:00 pm</option>
                          <option value="15:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("15:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>3:00 pm</option>
                          <option value="16:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("16:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>4:00 pm</option>
                          <option value="17:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("17:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>5:00 pm</option>
                          <option value="18:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("18:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>6:00 pm</option>
                          <option value="19:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("19:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>7:00 pm</option>
                          <option value="20:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("20:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>8:00 pm</option>
                          <option value="21:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("21:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>9:00 pm</option>
                          <option value="22:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("22:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>10:00 pm</option>
                          <option value="23:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("23:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11:00 pm</option>
                          <option value="23:59:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("23:59:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11:59 pm</option>
                          <option value="00:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("00:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>12:00 am</option>
                          <option value="01:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("01:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>1:00 am</option>
                          <option value="02:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("02:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2:00 am</option>
                          <option value="03:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("03:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>3:00 am</option>
                          <option value="04:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("04:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>4:00 am</option>
                          <option value="05:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("05:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>5:00 am</option>
                          <option value="06:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("06:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>6:00 am</option>
                          <option value="07:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then If ("07:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginstartime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>7:00 am</option>
                          </select>
                        </div>
                      </div>
</td>
                    <td>Login end time</td>
                    <td><div class="form-group">
                      <div class="col-sm-10">
                       <select name="loginendtime" size="1" class="form-control m-b" id="loginendtime">
                          <option value="08:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("08:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>8:00 am</option>
                          <option value="09:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("09:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>9:00 am</option>
                          <option value="10:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("10:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>10:00 am</option>
                          <option value="11:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("11:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11:00 am</option>
                          <option value="12:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("12:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>12:00 pm</option>
                          <option value="13:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("13:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>1:00 pm</option>
                          <option value="14:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("14:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2:00 pm</option>
                          <option value="15:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("15:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>3:00 pm</option>
                          <option value="16:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("16:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>4:00 pm</option>
                          <option value="17:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("17:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>5:00 pm</option>
                          <option value="18:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("18:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>6:00 pm</option>
                          <option value="19:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("19:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>7:00 pm</option>
                          <option value="20:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("20:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>8:00 pm</option>
                          <option value="21:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("21:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>9:00 pm</option>
                          <option value="22:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("22:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>10:00 pm</option>
                          <option value="23:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("23:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11:00 pm</option>
                          <option value="23:59:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("23:59:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>11:59 pm</option>
                          <option value="00:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("00:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>12:00 am</option>
                          <option value="01:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("01:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>1:00 am</option>
                          <option value="02:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("02:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>2:00 am</option>
                          <option value="03:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("03:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>3:00 am</option>
                          <option value="04:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("04:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>4:00 am</option>
                          <option value="05:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("05:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>5:00 am</option>
                          <option value="06:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("06:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>6:00 am</option>
                          <option value="07:00:00"  <%If (Not isNull(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then If ("07:00:00" = CStr(DoTime((rs_userlogin.Fields.Item("loginendtime").Value), 3, 2057))) Then Response.Write("selected=""selected""") : Response.Write("")%>>7:00 am</option>
                          </select>
                        </div>
                      </div></td>
                  </tr>
                  <tr>
                    <td>Login days</td>
                    <td colspan="3"><div class="form-group"><div class="col-sm-10">
                      <div class="i-checks"><span class="bodytext">
                        <label>
                          <input <%If (((rs_userlogin.Fields.Item("loginmon").Value)) = CStr("Mon")) Then Response.Write("checked=""checked""") : Response.Write("")%> <%If (((rs_userlogin.Fields.Item("loginmon").Value)) = ("Mon")) Then Response.Write("checked=""checked""") : Response.Write("")%>  name="loginmon" type="checkbox" id="loginmon" value="Mon">
                        </label>
&nbsp;&nbsp;Monday&nbsp;&nbsp;
<input <%If (((rs_userlogin.Fields.Item("logintue").Value)) = CStr("Tue")) Then Response.Write("checked=""checked""") : Response.Write("")%> <%If (((rs_userlogin.Fields.Item("logintue").Value)) = ("Tue")) Then Response.Write("checked=""checked""") : Response.Write("")%>  name="logintue" type="checkbox" id="logintue" value="Tue">
&nbsp;&nbsp;Tuesday&nbsp;&nbsp;
<input <%If (((rs_userlogin.Fields.Item("loginwed").Value)) = CStr("Wed")) Then Response.Write("checked=""checked""") : Response.Write("")%> <%If (((rs_userlogin.Fields.Item("loginwed").Value)) = ("Wed")) Then Response.Write("checked=""checked""") : Response.Write("")%>  name="loginwed" type="checkbox" id="loginwed" value="Wed">
&nbsp;&nbsp;Wednesday&nbsp;&nbsp;
<input <%If (((rs_userlogin.Fields.Item("loginthu").Value)) = CStr("Thu")) Then Response.Write("checked=""checked""") : Response.Write("")%> <%If (((rs_userlogin.Fields.Item("loginthu").Value)) = ("Thu")) Then Response.Write("checked=""checked""") : Response.Write("")%>  name="loginthu" type="checkbox" id="loginthu" value="Thu">
&nbsp;&nbsp;Thursday&nbsp;&nbsp;
<input <%If (((rs_userlogin.Fields.Item("loginfri").Value)) = CStr("Fri")) Then Response.Write("checked=""checked""") : Response.Write("")%> <%If (((rs_userlogin.Fields.Item("loginfri").Value)) = ("Fri")) Then Response.Write("checked=""checked""") : Response.Write("")%>  name="loginfri" type="checkbox" id="loginfri" value="Fri">
&nbsp;&nbsp;Friday&nbsp;&nbsp;
<input <%If (((rs_userlogin.Fields.Item("loginsat").Value)) = CStr("Sat")) Then Response.Write("checked=""checked""") : Response.Write("")%> <%If (((rs_userlogin.Fields.Item("loginsat").Value)) = ("Sat")) Then Response.Write("checked=""checked""") : Response.Write("")%>  name="loginsat" type="checkbox" id="loginsat" value="Sat">
&nbsp;&nbsp;Saturday&nbsp;&nbsp;
<input <%If (((rs_userlogin.Fields.Item("loginsun").Value)) = CStr("Sun")) Then Response.Write("checked=""checked""") : Response.Write("")%> <%If (((rs_userlogin.Fields.Item("loginsun").Value)) = ("Sun")) Then Response.Write("checked=""checked""") : Response.Write("")%>  name="loginsun" type="checkbox" id="loginsun" value="Sun">
&nbsp;&nbsp;Sunday&nbsp;&nbsp; </span></div>
                    </div></div></td>
                  </tr>
                  <tr>
                    <td>Expires on</td>
                    <td><div class="form-group">
                   
                      <div class="col-sm-10" id="data_1">
                        <div class="input-group date" > <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                          <input name="ExpDate" type="text" class="form-control"  id="ExpDate" form="form1" placeholder="mm/dd/yyyy" value="<%= DoDateTime((rs_userlogin.Fields.Item("ExpDate").Value), 2, 9225) %>" maxlength="10">
                        </div>
                      </div>
                    </div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="4" class="alert-warning">Modules</td>
                  </tr>
                  <tr>
                    <td>Questionnaire</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSQnr").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSQnr" type="checkbox" id="CMSQnr" value="1" class="chkfill"/>
                      </div>
                    </div>
                    </td>
                    <td>Contacts</td>
                    <td> <div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSContacts").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSContacts" type="checkbox" id="CMSContacts" value="1"/>
                      </div>
                    </div>                  
                   </td>
                  </tr>
                  <tr>
                    <td>Cases</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSCases").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSCases" type="checkbox" id="CMSCases" value="1"/>
                      </div>
                    </div>
                   </td>
                    <td>Employers</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSEmployers").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSEmployers" type="checkbox" id="CMSEmployers" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td>Billing</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecBilling").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecBilling" type="checkbox" id="SecBilling" value="1"/>
                      </div>
                    </div></td>
                    <td>Regional Centers</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSRegionalCenter").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSRegionalCenter" type="checkbox" id="CMSRegionalCenter" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td>Agents</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSAgents").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSAgents" type="checkbox" id="CMSAgents" value="1"/>
                      </div>
                    </div></td>
                    <td>Messages</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSMessages").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSMessages" type="checkbox" id="CMSMessages" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td>Reports</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSReports").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSReports" type="checkbox" id="CMSReports" value="1"/>
                      </div>
                    </div></td>
                    <td>Tools</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("CMSTools").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CMSTools" type="checkbox" id="CMSTools" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td>Delete </td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("DeleteFiles").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="DeleteFiles" type="checkbox" id="DeleteFiles" value="1"/>&nbsp;&nbsp;&nbsp;&nbsp;(contacts|employers|cases)
                      </div>
                    </div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td colspan="4" class="alert-warning">Case module</td>
                  </tr>
                  <tr>
                    <td>Links</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecAttorneys").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecAttorneys" type="checkbox" id="SecAttorneys" value="1"/>
                      </div>
                    </div></td>
                    <td>Forms</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecForms").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecForms" type="checkbox" id="SecForms" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td>Notes</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecComments").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecComments" type="checkbox" id="SecComments" value="1"/>
                      </div>
                    </div></td>
                    <td>Reminders</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecReminders").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecReminders" type="checkbox" id="SecReminders" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td>Documents</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecDocuments").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecDocuments" type="checkbox" id="SecDocuments" value="1"/>
                      </div>
                    </div></td>
                    <td>Steps</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecSteps").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecSteps" type="checkbox" id="SecSteps" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td colspan="4" class="alert-warning">Billing module</td>
                  </tr>
                  <tr>
                    <td>Edit</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecBilling").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecBillingedit" type="checkbox" id="SecBillingedit" value="1"/>
                      </div>
                    </div></td>
                    <td>Delete</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("SecBillingdelete").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SecBillingdelete" type="checkbox" id="SecBillingdelete" value="1"/>
                      </div>
                    </div></td>
                  </tr>
                  <tr>
                    <td>Trust accounts</td>
                    <td><div class="col-sm-10">
                      <div class="i-checks">
                        <input <%If (CStr((rs_userlogin.Fields.Item("BillingTrstaccnt").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="BillingTrstaccnt" type="checkbox" id="BillingTrstaccnt" value="1"/>
                      </div>
                    </div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </tbody>
              </table>
              <input type="hidden" name="MM_update" value="form1">
              <input type="hidden" name="MM_recordId" value="<%= rs_userlogin.Fields.Item("UserLoginId").Value %>">
            
            </div>
          </div>
          </div>
        </div>
    </div>
  </form>
<!-- Content ends-->

<!--#include file="../includes/bdot/footer.asp"-->
</div>
</div>



<!-- Bootstrap scripts -->
<script src="../includes/js/plugins/sweetalert/sweetalert.min.js"></script>
<!--#include file="../includes/bdot/bdotbootstrapscripts.asp"-->   
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
$(document).ready(function() {

    $("form").submit(function (event) {
        $("form").data('formValidation').disableSubmitButtons(false);
    });

    $('#ExpDate')
        .datepicker({
			todayHighlight:new Date(),
			autoclose: true,    // The default value is false
            format: 'mm/dd/yyyy'
        })
        .on('changeDate', function(e) {
            // Revalidate the date field
            $('#form1').formValidation('revalidateField', 'ExpDate');
        });


    $('#form1').formValidation({
        framework: 'bootstrap',
        icon: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            ExpDate: {
                validators: {
					date: {
                        format: 'MM/DD/YYYY',
                        message: 'The expiration date is not in a valid date format (mm/dd/yyyy)'
                    }
                }
            },
					
			
 }
		
    //-- do not ever disable submit button
    }).on('err.field.fv', function (e, data) {
        data.fv.disableSubmitButtons(false);
    }).on('success.field.fv', function (e, data) {
        data.fv.disableSubmitButtons(false);
    });
});
});//]]>  

</script>


<script>
 $('a.btn-warning.btn-sm1').click(function(e) { 
    e.preventDefault(); // Prevent the href from redirecting directly
    var linkURL = $(this).attr("href");
    warnBeforeRedirect(linkURL);
  });

  function warnBeforeRedirect(linkURL) {
    swal({
      title: "Are you sure?", 
      text: "Please confirm you wish to delete the password", 
      type: "warning",
	  confirmButtonColor: "#DD6B55",
      showCancelButton: true,
    }, function() {
      // Redirect the user
      window.location.href = linkURL;
    });
  }
  
  </script>
  
  <script>
 $('a.btn-white.btn-sm2').click(function(e) { 
    e.preventDefault(); // Prevent the href from redirecting directly
    var linkURL = $(this).attr("href");
    warnBeforeRedirect(linkURL);
  });

  function warnBeforeRedirect(linkURL) {
    swal({
      title: "Are you sure?", 
      text: "Please confirm you wish to reset the password", 
      type: "warning",
	  confirmButtonColor: "#DD6B55",
      showCancelButton: true,
    }, function() {
      // Redirect the user
      window.location.href = linkURL;
    });
  }
  
  </script>
  
  <script>
    $("#selectall").change(function() {
    if(this.checked) {
        $(".chkfill").prop("checked", true);
    }
});
</script>

</body>
</html>

Open in new window

0
 
LVL 9

Expert Comment

by:James Bilous
ID: 41766002
I notice you have the class on only one button but you mention that there are multiple buttons that need to become checked after selectall is clicked. You'll need that class on all those buttons.

And you said there are no javascript errors when you look in your browser's console?
0
 

Author Comment

by:amucinobluedot
ID: 41766003
Correct. Just testing with one at this time
0
 
LVL 9

Expert Comment

by:James Bilous
ID: 41766014
Not positive where the issue is. You can see a working jsfiddle example on this page:

https://jsfiddle.net/fnL88f2u/

I'm not seeing where jquery is being included in that example you sent me - what version are you using?
0
 

Author Comment

by:amucinobluedot
ID: 41766019
Ok Ill test and see if the i-check is interfering somehow. I am heading home and test from there. thx.
One thing I noticed in your example it only checks the box, if I uncheck the master checkbox it won't uncheck the others
0
 

Author Comment

by:amucinobluedot
ID: 41766059
Could you add the option to deselect if the master checkbox is deselected ?

I added your checkboxes and code to my page and it worked. I think the classes are interfering with the checkbox being checked. Still testing.
0
 

Author Comment

by:amucinobluedot
ID: 41766062
the class i-check does interfere with the script.

This is the plugin, I looked around but could not find any clear instructions on what to do so that other scripts such as this one will work with the class.
0
 

Author Comment

by:amucinobluedot
ID: 41766073
I opened a separate question for the issue with i-check. If we can just pls add code to uncheck all boxes if the master box is unchecked  :)
0
 
LVL 9

Accepted Solution

by:
James Bilous earned 500 total points
ID: 41766236
The following should work to toggle the checkboxes:
  
$("#selectall").change(function() {
    if(this.checked) {
        $(".chkfill").prop("checked", true);
    }
    else
    { 
        $(".chkfill").prop("checked", false);
    }
});

Open in new window

0
 

Author Comment

by:amucinobluedot
ID: 41766259
Works perfectly thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to count occurrences of each item in an array.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question