473,418 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

How can i read the Make all the Columns Editable on the Click of CheckBox

Hi Friends,

What is the way to iterate the Table and Make all the input types editable on the click of a checkbox.
Here is what My Requirement is :

Expand|Select|Wrap|Line Numbers
  1.         <table id="adSearchTable" cellspacing="3">
  2.             <thead>
  3.  
  4.                 <tr class="tableheader" style="height: 15px;">
  5.  
  6.                         <td class="tableheader" align="center">Name</td>
  7.  
  8.                         <td class="tableheader" align="center">Edit</td>                    
  9.  
  10.                         <td class="tableheader" align="center">Location</td>
  11.  
  12.                         <td class="tableheader" align="center">Salary</td>
  13.  
  14.                         <td class="tableheader" align="center">History</td>
  15.  
  16.                 </tr>
  17.  
  18.             </thead>
  19.             <tbody>
  20.                 <tr id="tr128009114">
  21.                     <td>Ashish</td>
  22.                         <td> <input name="tagLevelOptimizationBean[0].optimize" value="on" type="checkbox"> </td>
  23.                         <td>
  24.                             <input name="tagLevelOptimizationBean[0].Location" value="Hisar" disabled="disabled" type="text">
  25.                         </td>
  26.                         <td>
  27.                             <input name="tagLevelOptimizationBean[0].Salary" value="12344" disabled="disabled" type="text">
  28.  
  29.                          </td>                       
  30.                          <td>
  31.                             <input name="tagLevelOptimizationBean[0].History" value="Software" disabled="disabled" type="text">
  32.                          </td>
  33.             </tr>
  34.         <tr id="tr128009115
  35. ">
  36.                     <td>Amit</td>
  37.                         <td> <input name="tagLevelOptimizationBean[0].optimize" value="on" type="checkbox"> </td>
  38.                         <td>
  39.                             <input name="tagLevelOptimizationBean[0].Location" value="Pune" disabled="disabled" type="text">
  40.                         </td>
  41.                         <td>
  42.                             <input name="tagLevelOptimizationBean[0].Salary" value="352345" disabled="disabled" type="text">
  43.  
  44.                          </td>                       
  45.                          <td>
  46.                             <input name="tagLevelOptimizationBean[0].History" value="IT" disabled="disabled" type="text">
  47.                          </td>
  48.             </tr>
  49.  
  50.             </tbody>
  51.          </table>    
In this table, there may be any no of rows can exist. But i need to make the row editable to all columns (except First Column - > Name) when a checkbox of that row is clicked.

Can somebody tell me how to do this? Thanks for your replies in advance.
Feb 20 '08 #1
3 1482
Can Anybody help me out with this ?


Hi Friends,

What is the way to iterate the Table and Make all the input types editable on the click of a checkbox.
Here is what My Requirement is :

Expand|Select|Wrap|Line Numbers
  1.         <table id="adSearchTable" cellspacing="3">
  2.             <thead>
  3.  
  4.                 <tr class="tableheader" style="height: 15px;">
  5.  
  6.                         <td class="tableheader" align="center">Name</td>
  7.  
  8.                         <td class="tableheader" align="center">Edit</td>                    
  9.  
  10.                         <td class="tableheader" align="center">Location</td>
  11.  
  12.                         <td class="tableheader" align="center">Salary</td>
  13.  
  14.                         <td class="tableheader" align="center">History</td>
  15.  
  16.                 </tr>
  17.  
  18.             </thead>
  19.             <tbody>
  20.                 <tr id="tr128009114">
  21.                     <td>Ashish</td>
  22.                         <td> <input name="tagLevelOptimizationBean[0].optimize" value="on" type="checkbox"> </td>
  23.                         <td>
  24.                             <input name="tagLevelOptimizationBean[0].Location" value="Hisar" disabled="disabled" type="text">
  25.                         </td>
  26.                         <td>
  27.                             <input name="tagLevelOptimizationBean[0].Salary" value="12344" disabled="disabled" type="text">
  28.  
  29.                          </td>                       
  30.                          <td>
  31.                             <input name="tagLevelOptimizationBean[0].History" value="Software" disabled="disabled" type="text">
  32.                          </td>
  33.             </tr>
  34.         <tr id="tr128009115
  35. ">
  36.                     <td>Amit</td>
  37.                         <td> <input name="tagLevelOptimizationBean[0].optimize" value="on" type="checkbox"> </td>
  38.                         <td>
  39.                             <input name="tagLevelOptimizationBean[0].Location" value="Pune" disabled="disabled" type="text">
  40.                         </td>
  41.                         <td>
  42.                             <input name="tagLevelOptimizationBean[0].Salary" value="352345" disabled="disabled" type="text">
  43.  
  44.                          </td>                       
  45.                          <td>
  46.                             <input name="tagLevelOptimizationBean[0].History" value="IT" disabled="disabled" type="text">
  47.                          </td>
  48.             </tr>
  49.  
  50.             </tbody>
  51.          </table>    
In this table, there may be any no of rows can exist. But i need to make the row editable to all columns (except First Column - > Name) when a checkbox of that row is clicked.

Can somebody tell me how to do this? Thanks for your replies in advance.
Feb 21 '08 #2
vee10
141 100+
Hi,

This may solve ur problem

Expand|Select|Wrap|Line Numbers
  1. function check_click(id)
  2.     {
  3.     var ids=document.getElementById(id).getElementsByTagName("input"); 
  4.     var tableRow = document.getElementById(id).getElementsByTagName("input").length;           
  5.     for(i=1;i<parseInt(tableRow);i++)
  6.     {
  7.     if(document.getElementById(id).getElementsByTagName("input").item(i).disabled==0)    
  8.     document.getElementById(id).getElementsByTagName("input").item(i).disabled=1; 
  9.     else
  10.     document.getElementById(id).getElementsByTagName("input").item(i).disabled=0; 
  11.     }
  12.     }
Feb 21 '08 #3
acoder
16,027 Expert Mod 8TB
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for everyone to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

Thanks!
Feb 21 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: /.. | last post by:
Hi all, I'm working on a report display page that currently uses 5 checkboxlists with a total of 86 items to display values from 5 different tables in an Access database. The page works fine...
0
by: Alex | last post by:
I found some good information On "Including a Data Bound CheckBox in an Editable DataGrid... " at this site http://www.dedicatedsolutions.co.uk/DesktopDefault.aspx?tabid=62 It is worth the click
3
by: Angela Chen | last post by:
Hi, I have a readOnly textbox. I want to be able to double click it to make it editable? How to implement it?\ Thanks a lot
2
by: Suma | last post by:
I have a problem with editable datagrid and was hoping if anyone could help me. Please help me if possible. I have an editable datagrid, whose column count I don’t know until runtime. I am...
0
by: Luis Esteban Valencia | last post by:
I have a datagrid with no editable fields except checkboxes at the beginning of each row. Is it possible to make certain columns in a row editable if a user selects the checkbox of that row? I...
4
by: biswaranjan.rath | last post by:
Hi, I've few checkboxes in different rows. After selecting appropriate values, the user should click a button. I wanted to convert those checkbox values to non-editable(or non-editable...
4
by: farhaaad | last post by:
Hi all, i wanted to know how can i make my mdb file read only recommended, i mean when the user opens the database with holding the SHIFT key it shouldn't be read only and when opening the...
4
by: Steve Kershaw | last post by:
Hi, I have a gridview with an UpdateQuery() that's fired when the user edits/updates a row. The problem lies in the fact that every cell in the edited row shows up as editable even though one...
1
by: hamidawan | last post by:
Hi I have a problem with my ASP.Net Gridview Control. I have a GridView that has a variable number of columns. First two columns are permanent. Remaining CheckBox columns that contain...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.