# How can I set my Radio Button group to be required?

**URL:** <https://discuss.workflowgen.com/t/how-can-i-set-my-radio-button-group-to-be-required/196>\
**Category:** Visual Studio Web Forms\
**Created:** [February 2, 2010, 3:26am UTC](https://discuss.workflowgen.com/t/how-can-i-set-my-radio-button-group-to-be-required/196 "2010-02-02T03:26:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [February 2, 2010, 3:26am UTC](https://discuss.workflowgen.com/t/how-can-i-set-my-radio-button-group-to-be-required/196/1 "2010-02-02T03:26:00Z")

</div>

### Background

`RadioButton` is a .NET control that requires the `GroupName` attribute to associate multiple radio buttons to a group. By default, WorkflowGen does not support form field validation on `RadioButton`. However, .NET `RadioButtonList` controls are supported by WorkflowGen’s `FORM_FIELD_REQUIRED` parameter.

You can put radio buttons in different locations on your webform while `RadioButtonList` restricts the items to be aligned together.

### Solution

For instructions on how to use a `CustomValidator` control to validate the selection of the `RadioButton` group, see the [How can I use a .NET CustomValidator control in my WorkflowGen web form?](https://discuss.workflowgen.com/t/how-can-i-use-a-net-customvalidator-control-in-my-workflowgen-web-form/174) article.

The following example checks whether a radio button is checked within a radio button group:

```auto
function Validate_RadioButtonGroup(source, arguments)
{
 var ValidateResult = true;
 // buttonGroup refers to document.getElementsByName, not getElementById
 var buttonGroup = document.getElementsByName("[YOUR_RADIOBUTTON_GROUPNAME]");
 for (var i=0; i < buttonGroup.length; i++)
 {
 if (buttonGroup[i].checked)
 {
 // there is a radio button within the group selected
 ValidateResult = true;
 break;
 }
 }
arguments.IsValid = ValidateResult;
}

```
