Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4060820
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:23:15+00:00 2026-05-20T15:23:15+00:00

I am trying to create my own grid view. here I retrieve the food

  • 0

I am trying to create my own grid view. here I retrieve the food items from db and store it into a dynamically created table. these tables has a many row and all the row has a text-box to enter the quantity of the Particular Item. I want this text box to enable only when the check box is checked.

How to do this code.

I used this full day in searching answer for this. I am a beginner of j2ee application.
Please help me.

Please suggest some sites to find the scripts for accessible and editable data-grid samples.

The codes of that jsp page is as follows:

<%@ page import="java.sql.*" %> 
<%@ page import="java.io.*" %>  
<html> <head><title>orderSample</title>

    <script language="JavaScript"> <!--

    function enable_text(status,i) { status=!status;  document.orderForm.NAME_TEXT('i').disabled
    = status;///////here is the problem. how to insert i here . i want to do something like this//// } //--> </script>

    </head> 
<body bgcolor="white"> 
<form method=post name=orderForm> 
<h1>Data from the table 'item details' of database 'caffe' in sql </h1> 
<% ResultSet r=null; r=(ResultSet)request.getAttribute("message"); System.out.println(r); int i = 0; %> 
<TABLE cellpadding="15" border="1" style="background-color: #ffffcc;">    <TR>
             <TD>ORDER ID</TD>
            <TD>ORDER PRICE</TD>
            <TD>Quantity</TD>
            <TD>Add Item</TD>
            </TR>
        <%do{

            System.out.println("I am in Ob");
        %>
        <TR>
            <TD><%=r.getString(1)%></TD>
            <TD><%=r.getString(2)%></TD>       
           <!--  <td><INPUT TYPE="TEXT" NAME="NAME_TEXT<%=i%>" VALUE="" IsEnabled="{Binding ElementName=checkBox1, Path=IsChecked}"/></td>-->
            <td><INPUT TYPE="TEXT" NAME="NAME_TEXT<%=i%>" VALUE="" /></td>
            <td><input type="checkbox" name="others<%=i%>" onclick="enable_text(this.checked,<%=i%>)"
    ></td>
        </TR>    <%i++; }while(r.next()); %>
        </TABLE>
        </form> 
</body> 
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:23:15+00:00Added an answer on May 20, 2026 at 3:23 pm

    To enable a input text field using a checkbox in the same table row using JavaScript, it’s the easiest to grab jQuery.

    First, give the checkboxes and input fields in table rows a classname.

    <td><input type="checkbox" class="add" /></td>
    <td><input type="text" class="quantity" /></td>
    

    Then, you can use jQuery

    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script>
        $(document).ready(function() {
            $('.add').click(function() {
                $(this).closest('tr').find('.quantity').attr('disabled', !this.checked);
            });
        });
    </script>
    

    This basically tells every checkbox with class="add" that when clicked it should lookup the closest parent <tr> element and then locate the element with class="quantity" and then set its disabled attribute with the opposite of the checked state of the checkbox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to whip my brain into MVVM mode here. I have a Grid
I'm trying to create my own slideshow. The following code fades from one image
I'm trying to create my own UIView subclass. I've placed it on my view
I am trying to create my own Native win32 C++ Checkbox that can have
I am trying to create my own lightbox for images on my website. Yes,
I'm trying to create my own Magento shipping module in Magento 1.6. Since I
I am trying to create my own torrent tracker but dont know how to
I'm trying to create my own plugin. But I'm having trouble getting things right.
I'm trying to create my own templated List class as a practice excercise. I
I'm trying to create my own template for a List class as a learning

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.