formsPlayer 1.5.7 sees the introduction of new features to allow form authors to decide when the contents of a case element will load. This gives the form author finer control over the performance of an XForms document, by allowing them to choose whether to load some content at startup, or later on in the lifetime of a form instance. Until now, in 1.5 builds, the markup within a case element has been ignored until that case is first selected, giving potentially faster load times, but a slower reaction to the toggle action.
There are three new ways to ensure that a case element is ready prior to toggling into that case.
A case can now be preloaded through script- This could be actuated through some user interaction, or an event such as xforms-submit, to prepare the case for when it is needed.
<a href="#" onclick="document.getElementById('c1').loadContent();">Preload xf:case[@id="c1"] using some script</a>
If a switch contains a case which is almost always used, but is not the default case, and other cases are rarely used, that case can be loaded at startup thus:
<xf:case appearance="full"> ... </xf:case>
If all cases within a switch are likely to be used during a visit to the form, then the contents of all cases can be loaded at startup, by setting the appearance of the switch to full, thus:
<xf:switch appearance="full"> ... </xf:switch>