checkbox selection in jsp

Ads
 

checkbox selection in jsp

hey guys

i am working on a web based project using jsp. In my project i am having 9 check boxes in 3 rows in the same form. I want to select i check box from each row and also i want to avoid many check box 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,

<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>
</table>

</form>

Thanks


January 26, 2012 at 11:01 PM

The above solution works for html but not in jsp? Any changes to be made for jsp?

Ads









Related Tutorials/Questions & Answers:
checkbox selection in jsp
checkbox selection in jsp  hey guys i am working on a web based project using jsp. In my project i am having 9 check boxes in 3 rows in the same form. I want to select i check box from each row and also i want to avoid many
JSP Checkbox
JSP Checkbox In this tutorial you will learn how to create a checkbox using JSP. As we know, checkbox allows multiple selection at a time, but radio... selection always go for checkbox. Using the example we will try to understand how
Advertisements
JSP CheckBox
JSP CheckBox          JSP CheckBox is used to create a CheckBox in JSP... illustrate an elaborate example from 'JSP CheckBox'. To understand and grasp
java swing-action on checkbox selection
java swing-action on checkbox selection  I am working in netbeans...(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JCheckBox checkBox = new JCheckBox(des... = frame.getContentPane(); contentPane.add(checkBox, BorderLayout.NORTH); frame.setSize(300
Selection based on other selection in jsp
selection on same jsp page such that when someone select a category only the products...Selection based on other selection in jsp  I am trying to create a jsp page. Where I am having a select list containing category name and for each
how to get the checkbox value in jsp
how to get the checkbox value in jsp  how to get the checkbox value in jsp?   JSP CheckBox Example - how to get the checkbox value in jsp
checkbox with dropdown listbox in jsp
checkbox with dropdown listbox in jsp  i loaded the the data into the drop down listbox in jsp from access database.now i have to add a check box,if it checked means dropdownlist box carryout the data's,else it should
Selection With Ajax and JSP
Selection With Ajax and JSP  I am working at a jsp page using ajax for country , state, city selection. so if he select country it will populate the state and city selection (both). After selecting country if he select city
Learn about JSP CheckBox
Learn JSP CheckBox The tutorial highlight the features by whihc you will be able to know what is JSP checkbox and also how it works in creating a checkbox in JSP. Further, you can know in details about the multiple chechbox values
checkbox
checkbox  how to insert multiple values in database by using checkbox in jsp
deleting messages using checkbox in JSP
deleting messages using checkbox in JSP  Am working on a Mail Server Project. In that I have Inbox And Outbox Messages. Now Each and Every message...;input type="checkbox" name="inboxchk" value="<%=rs.getInt("omailid")%>"><
deleting messages using checkbox in JSP
deleting messages using checkbox in JSP  Am working on a Mail Server Project. In that I have Inbox And Outbox Messages. Now Each and Every message...;input type="checkbox" name="inboxchk" value="<%=rs.getInt("omailid")%>">
how to insert checkbox value into database using jsp
how to insert checkbox value into database using jsp  how to insert check box value to the database using jsp my code is <link href...; <td align="center"> <input type="checkbox
how to insert checkbox value into database using jsp
how to insert checkbox value into database using jsp  How to insert check box value to the oracle database using jsp? I want to create hotel's... for="pack_meal"></label> <input type="checkbox
how to insert checkbox value into database using jsp
;   Here is a simple jsp code that insert the selected checkbox values...how to insert checkbox value into database using jsp  How to insert check box value to the oracle database using jsp? I want to create hotel's
Modifying a single row of database based on selection in jsp
Modifying a single row of database based on selection in jsp  Hi guys...://www.roseindia.net/answers/viewqa/JSP-Servlet/18899-data-grid-with-edit-and-delete-options-at-each-row-.html http://www.roseindia.net/answers/viewqa/JSP
Drop-down text selection in jsp/html
Drop-down text selection in jsp/html  Hi, I am trying to create JSP page where I have two drop-downs. There are two-sets of data - First set Categories- Movies, Books, Music and the Second set Genres- Action,Comedy,Romantic
How to create textbox on combo value selection using javacsript in jsp?
How to create textbox on combo value selection using javacsript in jsp?  dynamically create textbox on combo value selection. when select multiple values then create multiple textboxes
JSP - Checkbox remain checked although checked values should depend on values stored in a stateful session bean
JSP - Checkbox remain checked although checked values should depend on values.... There are 3 JSP pages, shop1.jsp , shop2.jsp and shop3.jsp where each of these pages... displays all of the items selected. The selection of items is made using checkboxes
sir plz help in design a jsp page whichis as follow username [_____] select [__>]password [_____] after selection then onlypassword text box is visible
sir plz help in design a jsp page   sir plz help in design a jsp page which is as follow username [ _ ] select [ > ] password [ _ ] after selection then only password text box is visible
Checkbox method
Checkbox method  what is the method to check if the checkbox is checked
UIButton checkbox
UIButton checkbox  iPhone UIButton checkbox example required.. can any one please explain me.. how to create a checkbox button using UIButton in XIB
Checkbox
Checkbox       A checkbox is again a label which is displayed as a pushbutton as shown in the example... of the checkbox is either true or false. However, the initial state is false
Very urgent Image Selection - JSP-Servlet
Ajax Checkbox
Ajax Checkbox  I want ajax code for checkboxes.The scenario is that if a selectbox is selected the corresponding values to it in the database table are to be checked in the checkbox.....Please do help me
Dropdown Checkbox list
Dropdown Checkbox list This tutorial explains how to create jquery Dropdown Checkbox list in JSP.  This example is created in eclipse IDE and run... jquery Dropdown Checkbox list. The application directory structure should look like
JSP
JSP  Consider that we need to have a text, combo, radio & checkbox in JSP page and the page data's are retrieved from
enable disable checkbox in javascript
enable disable checkbox in javascript  How to enable disable checkbox in javascript
refresh checkbox jframe
refresh checkbox jframe  How to refresh checkbox button in JFrame
single selection of chechbox among multiple selection when in a loop.
single selection of chechbox among multiple selection when in a loop. ... that when in a loop i trying to choose single checkbox among multiple checkboxes but here am getting multiple selection(previous selected item also coming again
Reset checkbox style to default
Reset checkbox style to default  Reset checkbox style to default   input[type="checkbox"] { /* styles

Ads