check box in jsp

check box in jsp

hey guys

i am working on a web based project using jsp. In my project 1 am having 9 check boxes in 3 rows in the same form. I want to select 1 check box from each row and also i want to avoid many check box selected in the same row. How can i get this one working?

Can anyone help me

View Answers

January 22, 2011 at 5:57 PM

Hi Friend,

Try this:

<script>
function checkBoxValidate1(cb) {
for (j = 0; j < 3; j++) {
if (eval("document.myform.ckbox1[" + j + "].checked") == true) {
document.myform.ckbox1[j].checked = false;
if (j == cb) {
document.myform.ckbox1[j].checked= true;
         }
      }
   }
}

function checkBoxValidate2(cb) {
for (j = 0; j < 3; j++) {
if (eval("document.myform.ckbox2[" + j + "].checked") == true) {
document.myform.ckbox2[j].checked = false;
if (j == cb) {
document.myform.ckbox2[j].checked= true;
         }
      }
   }
}

function checkBoxValidate3(cb) {
for (j = 0; j < 3; j++) {
if (eval("document.myform.ckbox3[" + j + "].checked") == true) {
document.myform.ckbox3[j].checked = false;
if (j == cb) {
document.myform.ckbox3[j].checked= true;
         }
      }
   }
}
</script>
<BODY>

<form name=myform>
<table>
<tr><td>Selection 1<input type="checkbox" name="ckbox1" onClick="javascript:checkBoxValidate1(0)"></td><td>Selection 2<input type="checkbox" name="ckbox1" onClick="javascript:checkBoxValidate1(1)"></td><td>Selection 3<input type="checkbox" name="ckbox1" onClick="javascript:checkBoxValidate1(2)"></td></tr>

<tr><td>Selection 4<input type="checkbox" name="ckbox2" onClick="javascript:checkBoxValidate2(0)"></td><td>Selection 5<input type="checkbox" name="ckbox2" onClick="javascript:checkBoxValidate2(1)"></td><td>Selection 6<input type="checkbox" name="ckbox2" onClick="javascript:checkBoxValidate2(2)"></td></tr>

<tr><td>Selection 7<input type="checkbox" name="ckbox3" onClick="javascript:checkBoxValidate3(0)"></td><td>Selection 8<input type="checkbox" name="ckbox3" onClick="javascript:checkBoxValidate3(1)"></td><td>Selection 9<input type="checkbox" name="ckbox3" onClick="javascript:checkBoxValidate3(2)"></td></tr>


</form>

Thanks









Related Tutorials/Questions & Answers:
check box in jsp
check box in jsp  hey guys i am working on a web based project using jsp. In my project 1 am having 9 check boxes in 3 rows in the same form. I want to select 1 check box from each row and also i want to avoid many check box
HI Jsp check box..!
HI Jsp check box..!  Hi all.. I want to update the multiple values of database table using checkbox..after clicking submit the edited field has to update and rest has to enable to update...please help me..its urgent
Advertisements
how to insert check box
how to insert check box   how to insert check box into jtable row in swing
check box left justification
check box left justification  how to make a check box left justification which is at right end? thanks in advance
click on check box
click on check box  I create a check box in HTML and when i click on my check box relative information in page store in database
check box condition
check box condition  Hai, my application has two check box one for chart and another one for table.when We click chart check box download only chart but table also download.same problem in table slection..xsl coding was used
Dynamic check box problem
Dynamic check box problem  In my project i have used a dynamic table, in the each row of that table there is one check box [that i have created... check boxes ... pleas help me as soon as possible...   1)application.jsp
combo box - JSP-Servlet
combo box  how to get a combo box in jsp page which allows editing as well as list box
Check Box Validation in PHP - PHP
Check Box Validation in PHP  How can validations done on check boxes more than 3?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/javascript-array/javascript-array-checkboxes.shtml
msg box in jsp
msg box in jsp  i need the source code to display the msgbox in jsp....but one condition is,i need to use it in the current page itself...now i use the message box means it prints it into another page...i need to resolve it plz
check box realtive information in page store in database
check box realtive information in page store in database  check box relative information in page store in database  hiiiiiiiii, Que I create a checkbox in html and when i click on my check box realtive information
List Box - JSP-Servlet
list box.on selecting one value in list box,i will retrieve values from database and store into another list box in same page using javascript :location.my problem is in first list box,value which i selected to get values is not displaying
Creating Check Box in Java Swing
Creating Check Box in Java Swing       This section illustrates you how to create a Check Box component in Java Swing. In this section, you can learn simply creating the Check Box
how to crate callout box in jsp - JSP-Servlet
how to crate callout box in jsp  how to create a callout box when pointing a link in jsp page like in MS-word document callout box. Please help me I want to use
combo box - JSP-Servlet
combo box  I am using a JSP form in which a combobox is given and I want to populate data in it from database and on the basis of yhe selected item I want to display related data in a textbox  Hi Friend, Create
JSP Text Box properties. - JSP-Servlet
JSP Text Box properties.  How do I restrict a text box created in JSP page only for numbers.. example: I have a function something like... any such in JSP. please let me know how to do it..  Hi Friend, Try
jsp list box - Java Beginners
jsp list box  I have two list boxs. the values for the first list box is retrieved from the mysql database. I want to fill the second list box...("http://localhost:8080/examples/jsp/country.jsp?id="+cid+"&&value="+val
How to check no records - JSP-Servlet
How to check no records  Hi all, I am developing an onlineshopping project, in that how i have 2 check no records. I saw an answer... to check and display your cart is empty.... PLs help me......... Reply
drop down box - JSP-Servlet
drop down box  when i enter some letter in the input box,the corresponding words of that particular letter must be displayed below as a list from the data base in the same input box as drop down. Thanks&Regards, VijayaBabu.M
Javascript List Box - JSP-Servlet
itself.my problem is in list box the semester which i selected is not showing in list box as selected.when i select,the page refreshes but i get the result what i expected.i need to show in list box as semester is selected but it doesnt
instead of text boxe i have to show check box as selected.
instead of text boxe i have to show check box as selected.  i have one text field. in that iam getting boolean value either true or false from... have to show check box as selected. Thanks In advance R.Raveen.
Auto Complete Text Box - JSP-Servlet
Auto Complete Text Box  Please help me in Aotocomplete text box code. I m a java programmer. I m working on jsp tech. please give me the code for Autocomplete text box in which the values will generate from database table
check username availability using JSP & JQuery
check username availability using JSP & JQuery  Hi sir I want check username availability using JSP & JQuery. Please add code with your answer. Thnks in advance
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  For example, In Employee.jsp form, When i click employee id value in combo box...... i already stored combo box values from database. pl
Checkbox Problem--Please Check this - JSP-Servlet
Checkbox Problem  I am facing a problem while creating a check box in JavaScript. Can any one share the part of code to create a checkbox in JavaScript
display from select box - JSP-Servlet
display from select box  I am doing a jsp project. In this jsp... selection box which is in the same page. The photos are stored...://www.roseindia.net/jsp/file_upload/ http://www.roseindia.net/jsp/file_upload
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  I am using a single jsp form.. i did not get from another form.. i do not use 2 jsp form.. all.... Note: I am using only this jsp form.. i do not use
JSTL - check odd/even number - JSP-Servlet
JSTL - check odd/even number  How do i create a JSTL program to generate random numbers and to check whether they are odd/even and print...: http://www.roseindia.net/jsp/jsp-jstl-c-when-tag.shtml Thanks
how to get combo box value - JSP-Servlet
how to get combo box value  i have created 1 servlet & 1 jsp page. in servlet page i have fired query & fetched name & its id & that i have shown in combo box in jsp page: (small part of my code) "> now i want
Auto Complete Text Box - JSP-Servlet
Auto Complete Text Box - JSP-Servlet  Auto Complete Text Box Please help me in Aotocomplete text box code. I m a java programmer. I m working on jsp tech. please give me the code for Autocomplete text box in which the values
How to retrieve data using combo box value in jsp? - JSP-Servlet
How to retrieve data using combo box value in jsp?  Hi freind, I already post this question. I need urgent help from u. pl response me... the following link: http://www.roseindia.net/jsp/comboSelect.shtml Hope
approve or reject multiple selected rows using check box
approve or reject multiple selected rows using check box   Select Article Document Type Document Sub Type
dependent drop down box - JSP-Servlet
the solution how to extract data from dependent drop down box with page refresh...; window.location.replace("http://localhost:8080/examples/jsp/dependentDropdown.jsp?id="+cid+"&&value...; window.location.replace("http://localhost:8080/examples/jsp/dependentDropdown.jsp
populating text box using jsp code
populating text box using jsp code  Sir, How to populate related values in a text box after selecting value from drop down list using JSP and mysql.... Please give an example using jsp code only.   dependentDropdown.jsp
check where is error - JSP-Interview Questions
check where is error  hi deepak i have made a program in javascript but it is not working properly will u plz tell me where is error in my program javscsript program function palindrome() { var string
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  Hi Friends, When i click combobox value in jsp form page, it will diplay...... For Example, in Student.jsp... when i click student id in combo box
Automatically display in text box - JSP-Servlet
Automatically display in text box  Dear Deepak Sir, When i enter some text in text box.That corresponding value in database,the value display in another text box using ajax. Thanks & Regards, VijayaBabu.M
Name Display in alert box - JSP-Servlet
the alert box but the value is not in data base alert box is not display... username = request.getParameter(?username?); boolean isExist = check(username... Name is available.?); } } public boolean check(String username) { Connection
scroll bars to list box - JSP-Servlet
scroll bars to list box  Can I add scroll bars to a list box in struts?  Hi friend, Scroll the list box in struts Two attribute set "multiple" "size". Select Tag Example Select Tag
loading value into combo box by selecting value from other combo box - JSP-Servlet
loading value into combo box by selecting value from other combo box  ... is that as i select state from state_combo_box,then the next combo box is dynamically... box with constituency corresponding to district..... all three combo box
Check Box Midlet Example
;, "J2ME", "J2EE", "JSF"). if user select a check box... J2ME CheckBox ChoiceGroup MIDlet       This example illustrates how to create check
To get the value of more than one text box in an HTML page to a jsp page - JSP-Interview Questions
To get the value of more than one text box in an HTML page to a jsp page  An html file has a text box as To get the value of this text box in a JSP... file has a text box as To get the value of this text box in a JSP file
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
How to get data from DB in to Text box by using Jsp & Ajax
How to get data from DB in to Text box by using Jsp & Ajax   I want to get the data from database in to text box in a jsp page by using Ajax. If I enter the letter A in the textbox it should show only those values which starts
To Retain the values entered in the text box after submit in jsp page
To Retain the values entered in the text box after submit in jsp page   i am working on a jsp pge which has many text boxes and one dynamic drop... box , data is retreived from the database and displayed in table format. I have
i want to select a multiple value of check box by using onclick or onchange event without using from submission
i want to select a multiple value of check box by using onclick or onchange event without using from submission   i have 4 check box name 1)profile... the result is ok but after getting value of first box now i want a result of second box
jsp login code ... when username , drop down box and password is correct
jsp login code ... when username , drop down box and password is correct  i need a jsp code for login.... when username password and dropdown box... but its showing as wrong..... i dont know how to check the combo box selected value
How to retreive data by using combo box value - JSP-Servlet
How to retreive data by using combo box value  Hello friend , i am using only one form. U are using html form and jsp form. So get...){ cid=Integer.parseInt(request.getParameter("cid")); I am using only a single jsp
How to retreive data by using combo box value - JSP-Servlet
How to retreive data by using combo box value  I am using a single jsp form.. i did not get from another form.. i do not use 2 jsp form.. all.... Note: I am using only this jsp form.. i do not use to get values from
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box  Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one combo box is there and another filed is version of the server(like 1.0,2.0) like

Ads