History | Edit

The oxy_checkbox built-in form control is used for a graphical user interface box that you can click to enable or disable an option. A single checkbox or multiple checkboxes can be used to present and edit the value on an attribute or element.

The oxy_checkbox 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 visibility property to -oxy-collapse-text to render the text only in the form control that the oxy_editor function specifies.
  • resultSeparator - If multiple check-boxes are used, the separator is used to compose the final result. If not specified, the space character is used.
  • tooltips - Associates tooltips to each value in the values property. 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.
  • visible - Specifies whether or not the form control is visible. The possible values of this property are true (default value) and false.
  • values - Specifies the values that are committed when the check-boxes are selected. 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 true or false (default value). To make the form control inherit its font from its parent element, set the fontInherit property to true..
  • uncheckedValues - Specifies the values that are committed when check-boxes are not selected.
  • labels - This property must have the same number of items as the values property. Each item provides a literal description of the items listed in the values property. These labels can be translated using the ${i18n()} editor variable.. If this property is not specified, the values property is used as the label.
  • columns - Controls the layout of the form control. The check boxes will be grouped in a number of columns equal to the given value.
  • color - Specifies the foreground color of the form control. If the value of the color property is inherit, the form control has the same color as the element in which it is inserted.
  • 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_checkbox(hoverPseudoclassName, 'showBorder')
    }
    p:showBorder {
      border: 1px solid red;
    }
Example: Single oxy_checkbox Form Control
checkBox[attribute]:before {
    content: "A check box editor that edits a two valued attribute (On/Off)
              The values are specified in the CSS:"
        oxy_checkbox(
        edit, "@attribute",
        values, "On",
        uncheckedValues, "Off",
        labels, "On/Off"); 
}
Example: Multiple oxy_checkbox Form Controls
multipleCheckBox[attribute]:before {
    content: "Multiple checkboxes editor that edits an attribute value. 
              Depending whether the check-box is selected,
              a different value is committed:"
        oxy_checkbox(        
        edit, "@attribute",
        values, "true, yes, on",
        uncheckedValues, "false, no, off",
        resultSeparator, ","
        labels, "Present, Working, Started");
}
Tip: To insert a sample of the oxy_checkbox 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_checkbox 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: