Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet check box in jsp
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


varadhan raj
check box in jsp
1 Answer(s)      3 years and 11 months ago
Posted in : JSP-Servlet


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


Advertisement
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
check box left justification
check box left justification  how to make a check box left justification which is at right end? thanks in advance
how to insert check box
how to insert check box   how to insert check box into jtable row in swing
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
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
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
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
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
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
combo box - JSP-Servlet
combo box  how to get a combo box in jsp page which allows editing as well as list box
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.
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
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
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
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
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
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
Check Box Midlet Example
;, "J2ME", "J2EE", "JSF"). if user select a check box... J2ME CheckBox ChoiceGroup MIDlet       This example illustrates how to create check
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
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
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
check
updated"); will the above code check if the user has entered value for empcode
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
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
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
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
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
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 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
 

 

 

DMCA.com