MenuLiteral Element (Data)
Menus are useful whenever you need the user to select exactly one item from a collection of options. The role of the "menu_literal" element is to allow you to specify a fixed set of options to choose from. An classic example is the selection of gender on the "Personal" tab, where a menu allows the user to select either male or female. The complete list of attributes for this element is below.
field Id – Specifies the unique id of the field whose contents reflect the current selection from the menu. The field must be a text-based field and must exist within the pick/thing associated with the containing template. If this portal is not defined within a template, a menu is not allowed. maxvisible (Optional) Integer – Specifies the maximum number of items that will be visible at one time within the menu when the user opens it for selection. If there are more items to choose from, a scroller will allow the user to access them. Default: "5". allowuservalue (Optional) Boolean – Indicates whether the user is allowed to type in a custom value for use within the menu. If the user does this, the value saved for the menu is simply the text entered by the user. Default: "no". showlabel (Optional) Boolean – (iPad only) Indicates whether the label displaying the current selection of the menu should be shown. This is used when you just want the menu control to be used as a button to make a selection which will be displayed some other way. Default: "yes".
The "menu_literal" element also possesses child elements that define additional facets of the portal. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.
choice One or more "choice" elements must appear as defined by the given link. This element defines the individual options that the user can select from.
The "choice" Element
The "choice" element defines an option that is listed within the menu for the user to select. Each choice has two facets: the value shown to the user and the value used internally. The sequence in which these elements is defined dictates the sequence in which they will be listed for the user. The complete list of attributes for this element is below.
display Text – Specifies the text to be displayed for this choice. value (Optional) Text – Specifies the text to be tracked internally for this choice. When the user selects the choice, the value is saved into the associated field. If empty, the "display" text is used as the value. If the field used by the menu is value-based, all "value" attributes must be numeric values. Default: Empty.
The following example demonstrates what a literal menu portal might look like. All default values are assumed for optional attributes.
<portal id="gender" style="menuNormal"> <menu_literal field="perGender"> <choice value="0" display="Gender: Male"/> <choice value="1" display="Gender: Female"/> </menu_literal> </portal>