# Attribute for Radio boxes in JS?

**URL:** <https://forum.kirupa.com/t/attribute-for-radio-boxes-in-js/272868>\
**Category:** Uncategorized\
**Created:** [October 8, 2008, 11:36pm UTC](https://forum.kirupa.com/t/attribute-for-radio-boxes-in-js/272868 "2008-10-08T23:36:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hey\_suburbia](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@hey\_suburbia](https://forum.kirupa.com/u/hey_suburbia)\
**Post date:** [October 8, 2008, 11:36pm UTC](https://forum.kirupa.com/t/attribute-for-radio-boxes-in-js/272868/1 "2008-10-08T23:36:39Z")

</div>

I’m trying to make a form validate, everything works fine expect the radio button part.

You can see I have “checked” for my radio button, what this does is check to see if the FIRST radio button is checked and that’s it, I need it to check to see if ANY of the radio buttons in the group is checked.

```auto
case 'textarea':
    if(f.value==''){cf_adderr(f)}							
break;
case 'checkbox':
    if(!f.checked){cf_adderr(f)}							
break;
case 'radio':
    if(!f.checked){cf_adderr(f)}							
break;
case 'select-one':
    if(!f.selectedIndex && f.selectedIndex==0){cf_adderr(f)}							
break;

```
