Skip to Content
author's profile photo Former Member
Former Member

How to Know Whether a check box is checked or not in a group

How to Know Whether a particular check box is checked or not in check box group on client side by using javascript

Thanks and Regards

Markandeya

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on May 31, 2004 at 09:58 AM

    Hi

    To check the value of a checkbox, you use the the following javascript

    if(document.getElementById("<id of the checkbox>").checked == true)

    If this doesn't work, it may be because you are using HTMLb and you will have to generate the ID field dynamically so that you capture the correct ID of the checkbox

    I hope this helps

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi

      I think the problem is that when you use the getParamIdForComponent you need to pass in the relevant component as opposed to the name of the component in quotes

      Try this code in your JSP page

      <%String checkBoxId = null;%>

      <hbj:checkbox

      id="myCheckbox"

      text="Click Here"

      tooltip="Click Here"

      disabled="false"

      checked="false"

      >

      <%checkBoxId = myContext.getParamIdForComponent(myCheckbox);%>

      </hbj:checkbox>

      Where myContext is the ID of the hbj:content.

      The javascript would be

      document.getElementById('<%=checkBoxId%>').checked;

      I hope this helps

      D

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.