Combo Boxes

www.altova.com Expand/Collapse All Print this Topic Previous Page Up One Level Next page

Home >  SPS File: Content > Form Controls >

Combo Boxes

A combo box presents items in a dropdown list. The items in the list can be selected in one of the three ways listed below. This list can be used in the generated HTML document for any required purpose; for example the generated HTML can be post-processed so that the combo box list provides entries for an HTML form.

 

From the schema enumerations for the selected node.
From a list defined in the Edit Combo Box dialog. You enter the visible entry and the corresponding XML value, which may be different. The XML value applies to the Enterprise and Professional editions, and refers to the XML value to which the Authentic View user-selection maps. Basic edition users can leave this column blank (since Authentic View is not supported in Basic edition).
From the result sequence of an XPath expression relative to the current node. The items in the result sequence are displayed as the entries of the drop-down list. This is a powerful method of using dynamic entries in the combo box. The node that you create as the combo box is important. For example, say you have a NameList element that may contain an unlimited number of Name elements, which themselves have First and Last children elements. If you create the Name element as a combo box, and select the Last child element for the list values, then you will get as many combo boxes as there are Name elements and each combo box will have the Last child as its dropdown menu entry. In order to get a single combo box with all the Last elements in the dropdown menu list, you must create the single NameList element as the combo box, and select the Last element in the XPath expression.

 

Accessing the Edit Combo Box dialog

If you are creating a new combo box, when you create the node as a combo box, the Edit Combo Box dialog pops up. You can also insert a combo box with the  (Insert | Insert Form Controls | Combo Box) menu command. To access the Edit Combo Box dialog afterwards, do the following:

 

1.Select the combo box in the design.
2.In the Properties sidebar, select the combo box item and then the combo box group of properties (see screenshot below).

 

WinPropsComboBoxEditStd

 

3.Click the Edit button BtnEdit of the the content origin property. This pops up the Edit Combo Box dialog.

 

Using the Edit Combo Box dialog

The Edit Combo Box dialog is shown below.

 

Click to expand/collapse

 

To define the entries and values for the combo box, do the following:

 

1.Select the method with which you wish to define the entries and values by clicking the appropriate radio button: (i) schema enumerations, (ii) list of values, or (iii) XPath expressions to select values.
2.If you select Schema Enumerations, the enumerations assigned to that node in the schema are entered automatically as (i) the visible entries  of the drop-down list of the combo box, and (ii) the corresponding XML values (screenshot below). Visible Entries are the entries in the drop-down list of the combo box. Each drop-down list entry has a corresponding XML value. The XML value corresponding to the visible entry that the Authentic user selects will be the XML value that is entered in the XML file. Both visible entries and XML values are grayed out in the list of values because they are both obtained from the schema enumerations and cannot be edited.

 

dlg_edit_combobox_enums

 

If you select Use List of Values, you can insert, append, edit, and delete any number of entries for the drop-down list of the combo box as well as for the corresponding XML values. These edits are carried out in the pane below the Use List of Values radio button. You could also use an XPath expression to create the visible entries and XML values. The items in the sequence returned by the XPath expression will be used for visible entries and XML values. You can specify: (i) that the same XPath expression be used for visible entries and XML values, or (ii) that different XPath expressions be used. In the latter case, a one-to-one index mapping between the items of the two sequences determines the correspondence of visible entry to XML value. If the number of items in the two sequences are not equal, an error is reported.

3.If you wish to have the items that appear in the drop-down list of the combo box in Authentic View sorted, check the Sort Values in Authentic check box.
4.Click OK to finish.

 

Note

Using an XPath expression to select the items of the combo box drop-down list enables you to create combo boxes with dynamic entries from the XML file itself.
If the items in the drop-down list of the combo box are obtained from schema enumerations, they will be sorted alphabetically by default. If the items are obtained from an XML data file, they will appear in document order by default.

 

 

 


© 2019 Altova GmbH