Re: Checkbox in datagrid to enable disable textboxes
- From: "Dave Anderson" <NYRUMTPELVWH@xxxxxxxxxxxxx>
- Date: Wed, 21 Jun 2006 11:40:50 -0500
Ben wrote:
I tried your advice, however the same results are occuring.
I didn't exactly *give* advice -- I was pointing out potential causes for
your problem. But I can see from your code that you probably have another
problem altogether -- making sure that you have the right element pointers:
When I set the textboxes to
chkB.parentElement.parentElement.children.item(4).disabled=true;
The text inside of them turns grey, but the element can still recieve
focus and the user is able to edit the text inside.
Looks to me like you are setting a [disabled] property on the table cell.
This is not the same as the contents of the cell. What if you try something
like this?
function toggleRow(obj) {
var a=obj.parentNode.parentNode.getElementsByTagName("INPUT")
for (var i=0; i<a.length; i++)
if (a[i].type == "text") {
a[i].readOnly = !obj.checked
a[i].style.backgroundColor = obj.checked ? "#fff" :"#eee"
}
}
<input type="checkbox" onclick="toggleRow(this)" ...>
Note the use of the W3C-DOM-conforming "parentNode" instead of
"parentElement".
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
.
- References:
- Re: Checkbox in datagrid to enable disable textboxes
- From: Dave Anderson
- Re: Checkbox in datagrid to enable disable textboxes
- Prev by Date: Re: Checkbox in datagrid to enable disable textboxes
- Next by Date: code for interactive calendar
- Previous by thread: Re: Checkbox in datagrid to enable disable textboxes
- Next by thread: Re: Checkbox in datagrid to enable disable textboxes
- Index(es):
Loading