Using Radio Buttons

In this section:

How to:

When you drag the fields from the data source into the form, deselect the TITLE and USER fields so they do not appear in the form.

By not copying TITLE into the form, you prevent users from typing an arbitrary title in the field. Give them the option to type either Mr., Mrs., or Ms., using a radio button control. This prevents them from typing arbitrary titles.

The task of using radio buttons can be separated into three steps:

  1. Adding the group of radio buttons to your form.
  2. Adding tool tip text to the group of radio buttons. This step is optional, but it demonstrates how you can display useful information to your end users.
  3. Binding the results of the selection to a stack.

Top of page

x
Procedure: How to Add a Group of Radio Buttons to Your Form
  1. In the Maintain Controls palette, click the Radio button Radio button control.
  2. Draw a small rectangle on the form next to Ssn, First, and Last.

    When you let go of the mouse button, you see the green handles indicating that the control is selected. If you drew the rectangle large enough, you might see one radio button and the description of this radio button. (If you see nothing, just enlarge the size of the control.)

    Size Handles for selected control

  3. Double-click the control to open the List Source dialog box.

    List Source dialog box

  4. Double-click the highlighted text RadioButton1 to open the Enter a List Item dialog box.

    Enter a List Item dialog box

  5. Replace the text RadioButton1 with the text Mr. You do not need to type anything in the Assigned value field.
  6. Click OK or press Enter.
  7. Insert a new value by clicking the plus icon in the List Source dialog box.
  8. Type Mrs. and click OK or press Enter.
  9. Repeat steps 8 and 9 to type the value Ms.

    List Source dialog box

  10. Click OK.

    Your radio buttons should look like this (you may need to adjust the size of your control to see all three of them):

    radio button diagram


Top of page

x
Procedure: How to Add Tool Tip Text
  1. Make sure you have selected your group of radio buttons.
  2. In the Properties sheet, click the Properties tab.
  3. Select the ToolTipText property.
  4. In the empty field to the right, type Please select one and press Enter.

    Radio button dialog box

You can move your cursor over the radio buttons in the Form Editor to see the tool tip.


Top of page

x
Procedure: How to Bind the Results of the Selection to a Stack
  1. Make sure you have selected your group of radio buttons.
  2. In the Properties sheet, double-click the SelectedItem property to open the Binding the Selection Result dialog box.

    Binding the Selection Result dialog box

  3. Expand AddFanStack by clicking the plus sign to its left.
  4. Select the TITLE field.
  5. Make sure Text is selected for Send the result as.
  6. Click OK.

Now, when end users select either Mr., Mrs., or Ms. in this form, their choices are saved in the TITLE column of AddFanStack.

If you wish, save your work and deploy and run your application again to see how it looks. Make sure to close the application before continuing the tutorial.


Top of page

x
Stacks and Implied Columns

When you created AddFanStack using the Select Segment Fields dialog box (see How to Add Data Source Fields to a Form), you deselected the TITLE and USER fields. Since you deselected these fields, why are they showing up as columns in the data source stack?

These fields are showing up as columns in the data source stack because of the way WebFOCUS Maintain defines data source stacks with the INFER command. When you use a field in the data source to define a column in a data source stack, WebFOCUS Maintain defines columns based on the rest of the fields in that data source. If your data source is hierarchical, the rest of the fields in the segment and the key fields in any parent segment.

WebFOCUS Maintain includes all of these fields in your data source stack so that when you update your data source from the data source stack, it knows the path to these fields.

These columns are called implied columns.

There is one field from the fannames data source that you have not placed on the form: the USER field. The end user will not be entering this field. Instead, it will be generated by the application.


WebFOCUS