File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes checkbox property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "checkbox property" Watch "checkbox property" New topic

checkbox property

meghana maganti

Joined: Sep 13, 2005
Posts: 11
I have a group of checkboxes in my jsp page and i am trying to give
this part of code in javascript and using mozilla firefox browser but it complaines as the property length is "undefined"

for(var i=o; i<document.forms[0].ch_pk.length; i++) {

if(document.forms[0].ch_pk[i].checked == true) {

Marc Larochelle

Joined: Sep 16, 2005
Posts: 14
ch_pk is a checkbox?
What "length" sould return?
I don't think that you can "group" checkboxes, you can only do that with radio buttons no?
meghana maganti

Joined: Sep 13, 2005
Posts: 11
Hi Marc,

I am trying to display the checkboxes in a column when a list is iterated and checkbox lenght should return the number of checkboxes and from that i am trying to retrieve the ones that are checked in a JavaScript
I agree. Here's the link:
subject: checkbox property
Similar Threads
adding numbers
show/hide formfields
I need object name from value
How to submit a page on change of Combo using Struts
Java Script problem