Name

toggle

Synopsis

This action works with a switch element, selecting by IDREF a particular case within. The selected case is rendered, while all other cases are not. The ability to show and hide sections is a handy way to implement a “multiple page” form, which guides the user through one section at a time. It’s also useful within a page, to set up wizard-like sequences, or just to hide entire sections of the form that aren’t needed at the moment.

Each case contains a selected attribute, which stays in sync, so that at any given time one and only one of the cases in a switch will have selected="true“. In fact, in systems that support CSS2 selectors, one possible implementation is with the rule case[selected="false"] { display: none }.

The toggle action is used like this:

<toggle case="summary" ev:event="DOMActivate"/>

Get XForms Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.