Adding Datasets for Form Assets
Some form asset elements - those with multiple answer options such as radio buttons and checkboxes - can make use of datasets to auto-create the list of answer items. Enter the dataset in the "Advanced" tab of the element, and the form pulls the information in the dataset. Some datasets come predefined, but you can also make your own.
A conditional defined in the XSL creates the dataset based on the use of the Advanced field in the form element and the dataset named within. In the XSL, the name of the dataset to use gets passed to the XSL with $adv. The XSL does a choose test to return the correct dataset.
Another dataset can be added to the existing XSL as another "when" condition. The "when" condition is set off with double quotes, so the dataset name is included within single quotes.
- Navigate to Content > Pages.
- Find the
datasets.xslfile (typically located in
- Add your new dataset to the list. As an example, use the following dataset called "shakespeare":
The name of the dataset (
<xsl:when test="ou:get-adv($adv,'dataset') = 'shakespeare'"> Titus Andronicus,Taming of the Shrew,Henry IV Part 1,Henry IV Part 2,Henry V,Much Ado About Nothing,Twelfth Night,Othello,Hamlet </xsl:when>
shakespeare) and the values entered can be changed to whatever you want. Each item should be separated by a comma. Spaces can be used within an item, but character entities should not. For example, instead of an ampersand (&) the HTML entity should be used (&) and instead of a quote mark ('), the " entity should be used.
- Save the XSL file. It doesn't need to be published.
- Navigate to Content > Assets.
- Either edit an existing form asset or create a new one.
- Add one of the following form elements that supportsdatasets:
- Radio Buttons
- In the "Advanced" field, enter
- Save and republish the asset.