itp:group element
<itp:group
id=
level=
expandable=
expanded=
toggle-source=
toggle-value=
toggle-condition=
>
<itp:group-label/>
( <itp:layout-hint/> )?
( <itp:question/> | <itp:group/> | <itp:table/> )+
</itp:group>
Description
The <itp:group> element defines a set of <itp:question> elements that are grouped on the form. Interactive clients should provide a visual hint of such grouping.
If the form is interactively presented to a user, the <itp:group> element can also be used to collapse or expand the groups or to toggle the visibility of the group based on the value of another question on the form.
<itp:group> elements can be nested.
Attributes
Element | Description |
---|---|
id | Sequence number that uniquely identifies this group within the form. The id= attribute is used as the N value to identify the expandedN state in the <response> element. |
level | Nesting level of the group. |
expandable | Indicates whether or not this group can be expanded. If the value is true, an interactive client should render this group as a collapsible/expandable element. |
expanded | Indicates the original state of the group. If the value is true, an interactive client should render this group expanded. This value matches the value of the matching <expanded> element in the XForms instance data. |
toggle-source | Indicates the question that controls whether or not this group should be toggled as
visible/hidden.
If this attribute is not present an interactive client should always show this group and ignore other toggle- attributes. |
toggle-value | Indicates the value on which the group is shown or hidden. |
toggle-condition | Indicates the condition on which the group is shown or hidden. Possible conditions are:
Note that the list of conditions can be expanded in future versions of KCM. |
Content
Element | Description |
---|---|
<itp:group-label> | This element defines the heading for the group. |
<itp:question> | One or more questions. |
<itp:group> | Nested groups of questions. |
<itp:table> | Table structure containing one or more questions. |
<itp:layout-hint> | This optional element specifies a layout hint for the group. It is only generated if the group has a LAYOUT element. |
Example
<itp:header>
<itp:title>Sample interact with a toggled group</itp:title>
<xforms:model>
<xforms:instance>
<response xmlns="">
<question1 />
<question2 />
<expanded1 />
</response>
</xforms:instance>
</xforms:model>
</itp:header>
<itp:question>
<xforms:input ref="question1">
<xforms:label>Toggle</xforms:label>
</xforms:input>
</itp:question>
<itp:group id="1" level="1" expandable="false" expanded="false" toggle-source="question1" toggle-value="42" toggle condition="<>">
<itp:group-label>Group</itp:group-label>
<itp:question>
<xforms:input ref="question2">
<xforms:label>Group question</xforms:label>
</xforms:input>
</itp:question>
</itp:group>
In this example, the "Group" group, containing the "Group question," is shown if the value of the "Toggle" question is not equal to 42. Otherwise, the group and its contents are hidden.