Replacing an input box with an input control
About input controls
Input controls provide an alternative to input boxesA form field in an input block. An input box accepts user data that will be inserted into a database. for users to enter information in input blocks or modification blocks. Whereas an input box requires a user to type information into the box, an input control presents a set of predefined choices from which a user makes a selection.
There are two kinds of input controls you can create with Namo WebEditor:
- Drop-down menus, which display a list of choices in a menu that “drops down” when the user clicks it
- Radio button groups, which are groups of labeled buttons similar to the choices in a multiple-choice question
In both types, the choices are mutually exclusive—that is, the user can only choose one item.
The primary benefit of using an input control instead of an input box for a particular database field is that it allows you to limit what users can enter. For example, if one of the database fields involved in an input block is intended to contain the name of the country a user lives in, it makes sense to limit what the user can enter to a list of known countries.
An equally important benefit of using an input control is that it allows you to insulate users from the real value that is entered into a particular database field, by “hiding” values behind labels supplied by a related field. For example, say you have an input block that your users use to provide information for a customer support inquiry, and one of the pieces of data the users must provide is the identity of the product the inquiry is regarding. Let’s assume the inquiry table in your customer support database has a field for product ID, but not for product name. However, forcing users to enter a product ID number in an input box is not exactly user-friendly. Instead, you can use a drop-down menu that obtains product names from a products table, while it supplies a numerical ID value to the inquiry table.
Note: Although it is possible to create an input control within the Database Wizard, it is usually easier to replace an input box with an input control after completing the wizard.
To replace an input box with a drop-down menu
- Click the input box you want to replace, and then press Delete.
- On the Develop menu, go to Database, click Field,and then click Drop-Down Menu. The Database Wizard for drop-down menus will open.
- Click Next to skip to Step 2 of the wizard. (You cannot change any of the settings in Step 1.)
- Specify the data source settings for the menu. (This step is identical to the corresponding step in the Database Wizard for input blocks and other block types. For details, see “Step 2: Data Source” in Creating an input block.)
- Click Next to continue to Step 3 of the wizard.
- In the list of tables and fields on the left, select the database field that will supply the labels in the menu, and then click Add.
- Select the database field that will supply the values of items in the menu, and then click Add.
- Click Next to continue to Step 4 of the wizard.
- If the two fields you added in the previous step of the wizard are not from the same table, enter a join condition in the Join box.
- If you want to filter the choices in the menu according to some criteria, enter a filter condition in the Filter box.
- If you want the menu items to be sorted a particular way, enter a sort condition in the Sort by box.
- Click Next to continue to the last step of the wizard.
- Click the triangle on the Target field box and select the database field that will receive the value of the selected item in the menu. (This should be the same as the target field of the input box you deleted in step 1.)
- Click the Item labels source field box and select the database field that will supply the labels in the menu.
- Click the Item values source field box and select the database field that will supply the values of items in the menu.
- In the Default value box, optionally enter a default valueThe initial contents of an input box, or the initial selection in an input control, when the document is opened in a browser. for the menu. (If you want the default value to be provided by a parameter, click the … button next to the Default value box and select a parameter. The menu will only list parameters that have been registered.)
- Click Finish.
To replace an input box with a radio button group
- Click the input box you want to replace, and then press Delete.
- On the Insert menu, point to Database, and then click Radio Button Group. The Database Wizard for radio button groups will open.
- Click Next to skip to Step 2 of the wizard. (You cannot change any of the settings in Step 1.)
- Specify the data source settings for the radio button group. (This step is identical to the corresponding step in the Database Wizard for input blocks and other block types. For details, see “Step 2: Data Source” in Creating an input block.)
- Click Next to continue to Step 3 of the wizard.
- In the list of tables and fields on the left, select the database field that will supply the labels of the radio buttons, and then click Add.
- Select the database field that will supply the values of the radio buttons, a
nd then click Add. - Click Next to continue to Step 4 of the wizard.
- If the two fields you added in the previous step of the wizard are not from the same table, enter a join condition in the Join box.
- If you want to filter the choices in the radio button group according to some criteria, enter a filter condition in the Filter box.
- If you want the radio buttons to be sorted a particular way, enter a sort condition in the Sort by box.
- Click Next to continue to the last step of the wizard.
- Click the triangle on the Target field box and select the database field that will receive the value of the selected radio button. (This should be the same as the target field of the input box you deleted in step 1.)
- Click the Button labels source field box and select the database field that will supply the labels of the radio buttons.
- Click the Button values source field box and select the database field that will supply the values of the radio buttons.
- In the Default value box, optionally enter a default valueThe initial contents of an input box, or the initial selection in an input control, when the document is opened in a browser. for the radio button group. (If you want the default value to be provided by a parameter, click the … button next to the Default value box and select a parameter. The menu will only list parameters that have been registered.)
- Click Finish.