# Javascript... on radiobox checked disabled="false"

**URL:** https://forum.kirupa.com/t/javascript-on-radiobox-checked-disabled-false/227964
**Category:** web dev
**Created:** [June 4, 2007, 8:53am UTC](https://forum.kirupa.com/t/javascript-on-radiobox-checked-disabled-false/227964 "2007-06-04T08:53:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Duck](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@Duck](https://forum.kirupa.com/u/Duck)
#### Post date: [June 4, 2007, 8:53am UTC](https://forum.kirupa.com/t/javascript-on-radiobox-checked-disabled-false/227964/1 "2007-06-04T08:53:51Z")

</div>

Hi im trying to create a simple script in javascript that disables and enables a text field when u press a certain checkbox.

Problem is that the checkboxes are build with php and cant be given an ID.  
So ive tried to do it with grabbing the element and that works.  
Now i want to make it easier for me to adjust so i dont have to make 6000 different script for different checkboxes.

it should work with document.formnaam.radionaam[nummer].checked  
but im getting undefined when i check it. seems it doesnt pick the names up because of the dots… Im not sure how to write it to make it work…

Thanks.

```auto

function textfieldCheck(naam, radionaam, nummer) {
    //alert(document.formnaam.radionaam[nummer].value);
    var radiopath = naam + . + radionaam + [+ nummer +] + .checked
    alert(radiopath);
    if (radiopath == 1) {
    alert('tog wel')
    }
    //alert(radiopath);
    //var textfield = radiopath + "_text"
    /*if (document.naam.radionaam[nummer].checked == 1) {
        document.naam.textveld.disabled = false;
    } else {
        document.naam.textveld.disabled = true;
    }*/
}

```
