No i think instead the names of the checkboxes should be different and
values can be same. B'Coz more than one checkbox can be checked. The case u
r telling will only be tre when we have radiobuttons instead of checkboxes
where only one radiobutton can be chosen.
For Eg:
          Active:
         <input type="checkbox" name="active" value="active">
     Active1:
         <input type="checkbox" name="active1" value="active">
and so one.
And when u submit the form the checkboxes which are clicked only returns
the value
so in the intermediate jsp page one can access the parameters with
getParameter function of the request headre and do the manupulations
accordingly. I hope this helps.




Xing Guohong <[EMAIL PROTECTED]> on 06/07/2000 03:11:21 PM

Please respond to A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Kher Tamanna-SWD-ITIL-UB/Itilmail)

Subject:  Re: How to access data from multiple selection of CheckBoxes




The follow is an example:
--begin
<html>
<%@ page language="java"%>
<script language="JavaScript">
<!--
function display()
{
 var ftest = document.test;
 var len = ftest.elements.length;
 var i = 0;
 var str = "You chose ";
 for(i = 0 ; i < len; i++)
 {
  if(ftest.elements[i].name == "test")
  {
   if(ftest.elements[i].checked)
   {
    str += ftest.elements[i].value;
    str += " ";
   }
  }
 }
 alert(str);
}
//-->
</script>
<form name="test">
<input type="checkbox" name="test" value="aaa">aaa:
<input type="checkbox" name="test" value="bbb">bbb:
<input type="checkbox" name="test" value="ccc">ccc:
<input type="checkbox" name="test" value="ddd">ddd:
<input type="button" name="ok" value="test"
onClick="javascript:display();">
</form>
</html>
--end

If you submit the page to another page that get the checkbox info, try
request.getParameter("test") in that page.

xgh



----- Original Message -----
From: Biren Patnaik
To: [EMAIL PROTECTED]
Sent: Wednesday, June 07, 2000 08:06 PM
Subject: How to access data from multiple selection of CheckBoxes


Hi,
Can anyone please suggest me how to generate data from multiple selection
of Check Boxes.
I m describing my problems as below.
I have got one List Boxes.There are 4 items in List Boxes.They are all
Numeric.They are 1997,1998,1999,2000 all are values for Year.
I have 4 Check Boxes,They are D1,D2,D3,D4.D1 is a column name of table
tab1,Like that D2 is a column name of table tab2,like of D3 and D4.
year is one of the column name of tab1,tab2,tab3 and tab4 table.
My problem is If I select 1997 from List Boxes and select D1,D2,D3 from
Check Boxes,I should get records generated from tab1,tab2,tab3 for the
year 1997
I will appreciate for any kinds of solution.
Thanks in advance
Biren

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to