Input Checkbox Value Finding Javascript

7 posts, 2 answers
  1. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 26 Jun 2012 Link to this post

    I call the script from input checkbox field that is inside of  RadPageView of RadDockZone of RadDock how i find that id
    <input type="checkbox" runat="server" name="ChkAdmin" value="Chk_Admin" id="Chk_Admins"
                                                                                                            onclick="Chk_AdminClick()" />Admin
    function Chk_AdminClick() {                               
                    debugger;
                    var chkBox = document.getElementsId('Chk_Admins');      
                    var Checked = document.getElementsId('Chk_Admins').checked;                               
                    var chkBox1 = document.getElementsByName('ChkAdmin');               
                    if(chkBox1.Checked == true)
                    {
                      setPrives("admin");
                    }
                    else
                    {setPrives("none");}
                }


    Regards,
    Mohamed
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Jun 2012 Link to this post

    Hi Mohamed,

    I suppose you want to access the input CheckBox in the JavaScript. Try the following code snippet.

    ASPX:
    <input type="checkbox" runat="server" name="ChkAdmin" value="Chk_Admin" id="Chk_Admins" onclick="Chk_AdminClick(this)" />

    JS:
    <script type="text/javascript">
        function Chk_AdminClick(sender) {
            var chkBox = sender;
            var Checked = chkBox.checked;
            if (Checked == true) {
                setPrives("admin");
            }
            else
            { setPrives("admin"); }
        }
    </script>

    Hope this helps.

    Thanks,
    Princy.
  3. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 26 Jun 2012 Link to this post



    <
    input type="checkbox" runat="server" name="ChkAdmin" value="Admin" id="Chk_Admins"
    onclick="Chk_AdminClick(this)" />Admin
    <input type="checkbox" runat="server" name="ChkTech" value="Technician" id="Chk_Technice"
    checked="checked" onclick="Chk_TechClick()" />Tech
    <input type="checkbox" runat="server" name="ChkReq" value="Requester" id="Chk_requestor"
    onclick="Chk_RequestorClick()" />Req
    Thanks For UR Reply Princy .
    It's Work Good How i find That
    I Have Three Check Box like how i find other check box

    Thanks Advance,
    Mohamed.
  4. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 27 Jun 2012 Link to this post

    Hello Princy

    How i find multiple input type check box in javascript ,
    It's Urgent ...


    Thanks Advance,
    Mohamed.
  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Jun 2012 Link to this post

    Hi Mohammed,

    I guess you want to access the other 2 checkboxes from Chk_AdminClick(this) event
    Try the following JS
    JS:
    <script type="text/javascript">
    function Chk_AdminClick(sender)
     {
       var chktech = document.getElementById('<%=Chk_Technice.ClientID%>');
       var chkreq = document.getElementById('<%=Chk_requestor.ClientID%>');
     }
    </script>

    Thanks,
    Princy.
  6. New
    New  avatar
    25 posts
    Member since:
    Jul 2012

    Posted 27 Jun 2012 Link to this post

    Thanks  For Ur Reply

    I'm already tried it not come


    Thanks Advance ,
    Mohamed.
  7. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Jun 2012 Link to this post

    Hi Mohamed,

    Unfortunately I couldn't replicate any problem. Here is the code that I tried and which is working as expected at my end.

    ASPX:
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
       <telerik:RadPageView ID="RadPageView1" runat="server" Selected="true">
          <telerik:RadDockZone ID="RadDockZone1" runat="server">
              <telerik:RadDock ID="RadDock1" runat="server" AutoPostBack="true">
                 <ContentTemplate>
                    <input type="checkbox" runat="server"  value="DoPostBack"  id="Chk_Admins" onclick="Chk_AdminClick()" />
                    <input type="checkbox" runat="server" name="ChkTech" value="Technician" id="Chk_Technice" checked="checked" />
                    <input type="checkbox" runat="server" name="ChkReq" value="Requester" id="Chk_requestor" />
                 </ContentTemplate>
              </telerik:RadDock>
          </telerik:RadDockZone>
       </telerik:RadPageView>
    </telerik:RadMultiPage>

    JS:
    <script type="text/javascript">
        function Chk_AdminClick(sender)
        {
            var chktech = document.getElementById('<%=Chk_Technice.ClientID%>');
            var chkreq = document.getElementById('<%=Chk_requestor.ClientID%>');
        }
    </script>

    Please provide your code if it doesn't helps.

    Thanks,
    Princy.
Back to Top