Portlet Factory, Version 6.1.2


 

Using the Radio Button Group builder

You need to specify several settings to create a group of radio buttons.

Selection Options

This is the list of choices offered to the user and is usually drawn from a variable. There are two option styles that are acceptable: Flat Options List or Name/Value Pairs

Selected Value

This is the value that is selected by default when the page is displayed. The value that you type in this field must match one of the options in the contents of the builder. You can also use a data reference like ${Variables/myVariable}.

For example, say you provide your builder with contents from a variable such as:

<Options>
 <option>cat</option>
 <option>dog</option>
 <option>bird</option>
</Options>

You could type bird in the selected value field to display bird as the default selected value. Or if you had a variable called, "myVariable," with the value of "cat", you could type ${Variables/myVariable} in the selected value field.

The option that matches the value specified in Selected Value is the one selected when the page is displayed. If the selected value does not match any of the options, then no default will be selected.

List Orientation

In most situations, you will want a "Vertical" orientation. This causes buttons to appear in a vertical list with accompanying labels listed one under the other. In some cases, such as when you need to provide only two or three choices, you might want to display the choices across the page on a single line. In this situation, choose "horizontal" to create this linear type of button layout.

Label and Value Elements

In general, the Label and Value elements are used to associate a visible label with an invisible value that is actually submitted. The Label Element specifies which value in a multi-valued source should become the text or visible label of an item in a select list. For example, if the output of some service call is a list in which each item is composed of three parts, the Label Element field allows specification of one of those parts as the item label, which will be visible in the list at runtime.

Consider the following structure:

<THE_STRUCTURE>
 <THE_LIST>
   <THE_ITEMS>
     <ITEM>
       <NAME>Fred</NAME>
       <AGE>22</AGE>
       <SSN>111223333</SSN>
     </ITEM>
     <ITEM>
       <NAME>Bob</NAME>
       <AGE>35</AGE>
       <SSN>222334444</SSN>
     </ITEM>
   </THE_ITEMS>
 </THE_LIST>
</THE_STRUCTURE>

The Value Element specifies which element in a node should be assigned to the "value" attribute of the <OPTION> tags in the list produced at runtime. It is this value that is actually posted when the users submits a form containing a radio button group. In the example above, if the sub-item "AGE" is specified as the Value Element, then when the name "Fred" is selected by the user and the form posted, the value "22" would be transmitted to the WebSphere Portlet Factory servlet, although this value would not be visible to the user (the "SSN" field is ignored).

  • Specifying a flat options list

    In the Radio Button Group builder, if the displayed label for each choice is the same as the text that should be returned by the control, use a simple flat list as the radio button group's data source.

  • Using name/value pairs

    In the Radio Button Group builder, To display something different to the user than the value that is returned from the control, your source data must include an element whose value will be used as the value for the Radio Button Group input and an element whose value will be used to provide a label for each radio button.

Parent topic: Radio Button Group builder


Library | Support |