Checkbox

Widget for a Boolean field in a static server pages, which enables the user to switch between true and false by clicking the checkbox.

XHTML Specification: <x-subst type="checkbox">

For more information, see <x-subst type="WidgetType"> .

Widget Properties

Widget Properties

Property

Description/More Information

Exclude

Exclude the field if it does not need to be sent to the browser.

Name:

checkbox

XHTML placeholder:

<x-subst type="checkbox">

For more information, see <x-subst type="WidgetType"> .

Description

The data type of a field represented by a Checkbox widget in a Static Server Page must be Boolean. At runtime, the value displayed by the Checkbox depends on the logical value of the boolean data in ProcScript.

Note:  Although Uniface supports three logical values for Boolean fields—true, false, and null (or an empty string), the HTML checkbox displayed in the browser at runtime only recognizes the values of true and false.

Uniface therefor applies the following rules to interpreting Boolean values in the Checkbox widget:

  • When the Boolean in Uniface is true it is shown as a checked box. When it is null or false it is shown as an unchecked box.
  • When a checked box returns from the browser, the new value in Uniface is true.
  • When an unchecked box returns from the browser, and the Boolean's original value was true or false, the new value is false.
  • When an unchecked box returns from the browser, and the Boolean's original value was null, the new value will be null.

As a consequence of this behavior, when using the Checkbox value in retrieve profiles, you may need to add additional code to ensure that the occurrences you want are retrieved. desire, depending on the business logic of your application.

Alternatively, you could use a RadioButton group instead of a Checkbox, with following ValRep: T=True;F=False;=All.

Development vs. Runtime Implementation

The display format of the field is ignored at runtime (by both webgen and webget).

When the field definition is copied to the layout, the XHTML source code is similar to the following:

<x-subst name="C_BOX.MY_ENTITY.MY_MODEL" type="checkbox">
  <input name="C_BOX.MY_ENTITY.MY_MODEL" value="" type="checkbox">
</x-subst>

At runtime, the webgen command generates the following HTML input elements:

  • A checkbox input element with the fully-qualified name of the field and its occurrence number (<input name="Field.Entity.Model.Occ" value="" type="checkbox">).

  • A hidden element with the name "#CB.Field.Entity.Model.Occ", which is used internally by Uniface.

    Note:  Do not use this hidden element to implement any business logic. It could be changed in the future.