RadioFormInput

Start changeThe RadioFormInput class represents a radio button input type in an HTML form. The radio button may be initialized as selected when constructed.

A set of radio buttons with the same control name make a radio button group. The RadioFormInputGroup class creates radio button groups. Only one radio button within the group may be selected at any time. Also, a specific button may be initialized as selected when the group is constructed.

The following code example shows you how to create a RadioFormInput object:

    RadioFormInput radio = new RadioFormInput("age", "twentysomething", "Age 20 - 29", true);
    System.out.println(radio.getTag());

The above code example generates the following tag:

<input type="radio" name="age" value="twentysomething" checked="checked" />

When you use this tag in an HTML form, it looks like this:

Age 20-29
End change