Modern Campus Catalog Emblem Modern Campus CMS Emblem Modern Campus Curriculum Emblem Modern Campus Involve Emblem Modern Campus Lifelong Learning Extended Education Emblem Modern Campus Message Emblem Modern Campus Navigate Emblem Modern Campus Schedule Emblem Modern Campus Virtual Tours & Maps Emblem Modern Campus Lifelong Learning Workforce and Community Emblem Site Menu Open Site Menu Close

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.

There are two methods for adding a new dataset to your XSL; which one you use depends on whether your implementation pulls in global XSL files from our repository. An easy way to check if you use the global XSL is to run a find on your resources folder for <xsl:import href="/var/staging/OMNI-INF/ (or <xsl:import href="/var/staging/[skin]/OMNI-INF/ if you share templates across an account). If one of your XSL files (usually common.xsl) contains this statement, then your implementation uses the global XSL.

No Global XSLLink to this section

  1. Navigate to Content > Pages.
  2. Find the datasets.xsl file (typically located in _resources/xsl/_shared).
  3. Add your new dataset to the list. As an example, use the following dataset called "shakespeare":
    <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>
    
    The name of the dataset (shakespeare) and the values entered can be changed to whatever you want. Each item should be separated by a comma, with no spaces in between. Spaces can be used within an item, but character entities should not. For example, instead of an ampersand (&) the HTML entity should be used (&amp;) and instead of a quote mark ('), the &quot; entity should be used.
  4. Save the XSL file. It doesn't need to be published.

With Global XSLLink to this section

  1. Navigate toContent>Pages.
  2. Find /_resources/xsl/shared/forms.xsl and open the source code editor.
  3. Paste the following code at line 312:
    <xsl:template name="customer-custom-datasets">
        <xsl:param name="dataset-name" />
        <xsl:choose>
            <xsl:when test="$dataset-name = 'custom-1'">option1,option2</xsl:when>
            <xsl:when test="$dataset-name = 'custom-2'">opt1,opt2</xsl:when>
    	<xsl:otherwise><xsl:value-of select=\"'************************************************************************************,
     Dataset used that is not configured. Please Check Configuration before publishing...,
     ************************************************************************************'\" />
    	</xsl:otherwise>
        </xsl:choose>
    </xsl:template>
  4. Replace 'custom-1' with the name of your new dataset.
  5. Add in the dataset values between the > and < characters, comma-separated with no spaces in between, and in the order you want. Spaces can be used within an item, but character entities should not. For example, instead of an ampersand (&) the HTML entity should be used (&amp;) and instead of a quote mark ('), the &quot; entity should be used.
  6. For each new dataset, copy the <xsl:when> statement and adjust as needed.
  7. Save the XSL file. It doesn't need to be published.

Adding a Dataset to a FormLink to this section

To add a custom dataset to a form asset:

  1. Navigate to Content > Assets.
  2. Either edit an existing form asset or create a new one.
  3. Add one of the following form elements that supports datasets:
    • Radio Buttons
    • Checkboxes
    • Dropdown
    • Multi-select
  4. In the "Advanced" field, enter dataset=####;, where #### is the name of your custom dataset.
  5. Save and publish the asset.

⇐ Return to Tutorials

By continuing to use this site, you agree to the storing of first- and third-party cookies on your device to enhance site navigation; analyze site, product, and service usage; and assist in our marketing and promotional efforts. Cookie Policy