Combo Box Form Control
The oxy_combobox built-in form control is used for providing a
graphical user interface object that is a drop-down menu of proposed values. This form control
can also be used for a combination of a drop-down menu and an editable single-line text
field.
The
oxy_combobox form control supports the following properties:- edit - Lets you edit the value of an attribute, the text content of an element,
or Processing Instructions (PI). This property can have the following values:
- @attribute_name - The name of the attribute whose value is being edited. If the attribute is in a namespace, the value of the property must be a QName and the CSS must have a namespace declaration for the prefix.
- #text - Specifies that the presented/edited value is the simple
text value of an element.Note: You can set the value of the
visibilityproperty to-oxy-collapse-textto render the text only in the form control that theoxy_editorfunction specifies.
- columns - Controls the width of the form control. The unit size is the width of the w character.
- width - Specifies the width of the
content area using relative (
em,ex), absolute (in,cm,mm,pt,pc,px), and percentage (followed by the%character) length units. Thewidthproperty takes precedence over thecolumnsproperty (if the two are used together). - visible - Specifies whether or not the form control is
visible. The possible values of this property are
true(default value) andfalse. - editable - This property accepts the true and false values. In addition to a drop-down menu, the true value also generates an editable text field box that allows you to insert other values than the proposed ones. The false value generates a drop-down menu that only accepts the proposed values.
- tooltips - Associates tooltips to
each value in the
valuesproperty. The value of this property is a list of tooltip messages separated by commas. If you want the tooltip to display a comma, use the${comma}variable. - values - Specifies
the values that populate the list of proposals. If these values are not specified in the
CSS, they are collected from the associated XML Schema..Note: Typically, when you use a comma in the values of a form control, the content that follows a comma is considered a new value. If you want to include a comma in the values, precede the comma with two backslashes. For example,
(values, '1\\, 2\\, 3, 4, edit, false)will display a form control that has 1, 2, 3 for the first value and 4 for the second value. - fontInherit - This value
specifies whether or not the form control inherits its font from its parent element. The
values of this property can be
trueorfalse(default value). To make the form control inherit its font from its parent element, set thefontInheritproperty totrue. - labels - This property must have the same number of items as
the
valuesproperty. Each item provides a literal description of the items listed in thevaluesproperty. These labels can be translated using the ${i18n()} editor variable.Note: This property is only available for read-only combo boxes (theeditableproperty is set tofalse). - color - Specifies the foreground color
of the form control. If the value of the
colorproperty isinherit, the form control has the same color as the element that was used to insert it. - hoverPseudoclassName - Allows
you to change the way an element is rendered when you hover over a form control. The value
is the name of a CSS pseudo-class. When you hover over the form control, the specified
pseudo-class will be set on the element that contains the form control.
p:before { content: oxy_combobox(hoverPseudoclassName, 'showBorder') } p:showBorder { border: 1px solid red; } - canRemoveValue - If the value is set to
trueand the combo box is not editable, then a new<Empty>value is added in that combo box. This clears or removes the value being edited, depending on if it edits an element or attribute. - onChange - Can be used to invoke an action when the value of the combo box
changes. The action can be created in the CSS using the
oxy_action()function or referenced from the framework by its ID. After the action is executed, the cursor remains in the combo box. Note that this property does not support actions defined by JavaScript code.
Example: oxy_combobox Form
Control
comboBox:before {
content: "A combo box that edits an attribute value.
The possible values are provided from CSS:"
oxy_combobox(
edit, "@attribute",
editable, false,
values, "value1, value2, value3",
labels, "Value no1, Value no2, Value no3",
onChange, oxy_action(
name, 'Insert',
operation, 'XQueryUpdateOperation',
arg-script, 'insert node <product>{xs:string(@attribute)}</product>
as last into .'));
}Tip: To insert a sample of the
oxy_combobox form control in a CSS
file (or LESS file), invoke the Content Completion
Assistant by pressing Ctrl + Space (Command + Space on OS
X) and select the
oxy_combobox code template.To see more detailed examples and more information about how form controls work in Oxygen XML Editor, see the sample files in the following directory: [OXYGEN_INSTALL_DIR]/samples/form-controls.
For more information about form controls, watch our video demonstration: