RadioFormInputGroup class

The RadioFormInputGroup class represents a group of RadioFormInput objects. A user can select only one of the RadioFormInput objects from a RadioFormInputGroup.

The RadioFormInputGroup class methods allow you to work with various attributes of a group of radio buttons. With these methods, you can:

The following example creates a radio button group:

    // Create some radio buttons.
    RadioFormInput radio0 = new RadioFormInput("age", "kid", "0-12", true);
    RadioFormInput radio1 = new RadioFormInput("age", "teen", "13-19", false);
    RadioFormInput radio2 = new RadioFormInput("age", "twentysomething", "20-29", false);
    RadioFormInput radio3 = new RadioFormInput("age", "thirtysomething", "30-39", false);
    // Create a radio button group and add the radio buttons.
    RadioFormInputGroup ageGroup = new RadioFormInputGroup("age");
    ageGroup.add(radio0);
    ageGroup.add(radio1);
    ageGroup.add(radio2);
    ageGroup.add(radio3);
    System.out.println(ageGroup.getTag());

The code example above generates the following HTML code:

    <input type="radio" name="age" value="kid" checked="checked" /> 0-12
    <input type="radio" name="age" value="teen" /> 13-19
    <input type="radio" name="age" value="twentysomething" /> 20-29
    <input type="radio" name="age" value="thirtysomething" /> 30-39