This is a migrated thread and some comments may be shown as answers.

Input Checkbox Value Finding Javascript

6 Answers 1504 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 26 Jun 2012, 06:53 AM
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

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Jun 2012, 09:12 AM
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.
0
mohamed
Top achievements
Rank 1
answered on 26 Jun 2012, 09:23 AM


<
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.
0
mohamed
Top achievements
Rank 1
answered on 27 Jun 2012, 05:18 AM
Hello Princy

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


Thanks Advance,
Mohamed.
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Jun 2012, 06:57 AM
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.
0
New
Top achievements
Rank 1
answered on 27 Jun 2012, 07:00 AM
Thanks  For Ur Reply

I'm already tried it not come


Thanks Advance ,
Mohamed.
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 Jun 2012, 07:15 AM
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.
Tags
General Discussions
Asked by
mohamed
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mohamed
Top achievements
Rank 1
New
Top achievements
Rank 1
Share this question
or