473,396 Members | 2,106 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,396 software developers and data experts.

problem with condition in checkboxes

53
hi all

my requirement is that when i clik my chek box the corresponding textbox should be enabled otherwise it should be disabled. following is my code:

<tr bgcolor="<%=rowColor%>">
<td>&nbsp;</td>
<td><input type="checkbox" name="chkbox2" value="Y"></td>
<td>Party code </td>
<td><input name="partyCd" type="text" maxlength="20" onDblClick="callLov('../lov/lovPartyCd.jsp','300','316')" size="10" id="partyCd" readonly>
<input name="partyDesc" type="text" onDblClick="callLov('../lov/lovPartyCd.jsp','300','316')" size="40" maxlength="10" readonly></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

please make change in this code to fulfill my requirements.

thanks in advance
Jul 22 '07 #1
3 1345
jesmi
53
hi all

my requirement is that when i clik my chek box the corresponding textbox should be enabled otherwise it should be disabled. following is my code:

<tr bgcolor="<%=rowColor%>">
<td>&nbsp;</td>
<td><input type="checkbox" name="chkbox2" value="Y"></td>
<td>Party code </td>
<td><input name="partyCd" type="text" maxlength="20" onDblClick="callLov('../lov/lovPartyCd.jsp','300','316')" size="10" id="partyCd" readonly>
<input name="partyDesc" type="text" onDblClick="callLov('../lov/lovPartyCd.jsp','300','316')" size="40" maxlength="10" readonly></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

please make change in this code to fulfill my requirements.

thanks in advance
Jul 22 '07 #2
prometheuzz
197 Expert 100+
Hi jesmi, I moved your thread from Java to JavaScript. Although the two names look a like, they're not the same language. I'm sure you'll get some assistence here.

Good luck.
Jul 22 '07 #3
gits
5,390 Expert Mod 4TB
hi all

my requirement is that when i clik my chek box the corresponding textbox should be enabled otherwise it should be disabled. following is my code:

<tr bgcolor="<%=rowColor%>">
<td>&nbsp;</td>
<td><input type="checkbox" name="chkbox2" value="Y"></td>
<td>Party code </td>
<td><input name="partyCd" type="text" maxlength="20" onDblClick="callLov('../lov/lovPartyCd.jsp','300','316')" size="10" id="partyCd" readonly>
<input name="partyDesc" type="text" onDblClick="callLov('../lov/lovPartyCd.jsp','300','316')" size="40" maxlength="10" readonly></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

please make change in this code to fulfill my requirements.

thanks in advance
hi ...

simply create a javascript-function that you call 'onclick' of your checkbox like the following example:

[HTML]<input type="checkbox" name="chkbox2" onclick="set_textbox_state(this);" value="Y">
[/HTML]

the function gets the checkbox-obj itself passed to it and so we may ask it for the checked-property:

Expand|Select|Wrap|Line Numbers
  1. function set_textbox_state(command_obj) {
  2.     // get a reference to the textbox-node
  3.     var tb = document.getElementById('partyCd');
  4.  
  5.     if (command_obj.checked) {
  6.         tb.removeAttribute('readonly');
  7.     } else {
  8.         tb.setAttribute('readonly', 'true');
  9.     }
  10. }
kind regards
Jul 22 '07 #4

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

Similar topics

1
by: daniel | last post by:
Hi, This is more a javascript than a PHP problem, but anyway, if anyone can help.... I have a script that will dynamically create a series of checkboxes according to the number of values in...
1
by: kannadasan | last post by:
Hi all I am using Datagrid where i place checkboxes in one column with some other columns.The purpose is, if i select the checkboxes and clicks the submit buton Email has to go to the selected...
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
5
by: Bob | last post by:
In a datagridview (vs2005, VB.net) I have two columns that are checkboxes. I need to check that only one of the two can be checked. Its not permissible to have the two selected to true, but they...
1
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
2
by: 1980dinesh | last post by:
Hi, I have a DatGrid and i have added a checkboxes as template column i have write javascipt code to check and unckeck but at button event of code behind i can't grab the (checked) true condition...
2
by: GISmatters | last post by:
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files...
6
by: rohit reja | last post by:
Hi everyone I am developing a website..the form in my php page has a lot of checkboxes..to set differebt options. Now how do i write mysql query for that form according to checkbox selected..is...
2
by: divyakgowda | last post by:
Hello all, My problem,i have written a javascript to check whether the checkboxes are checked or not.If its not checked,i will get an alert message,if i checked then say it is checked.This...
7
by: viki1967 | last post by:
I need one function javascript that: 1) when I enter in this htm page I see enabled only checkbox of categories A, M and T; checkboxes of microcategories all disabled; 2-a) If I select the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.