Thomas Gibbons Consulting Qualtrics Wiki

Contact TomG on Qualtrics Community

User Tools

Site Tools


choicegroupanchorexclusive

choiceGroupAnchorExclusive - Anchor or make choices exclusive in a choice group

The choiceGroupAnchorExclusive function can be used to anchor choices in a randomized choice group and/or make choices exclusive in multi-select choice group.

This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.

Set-up Instructions

Survey Header

Add the choiceGroupAnchorExclusive function to the survey header to make it available to any question in the survey. Go to Look & Feel → General → Header edit → and paste the provided choiceGroupAnchorExclusive function JS:

<script>/*Paste choiceGroupAnchorExclusive function JS here*/</script>

Alternatively, paste the choiceGroupAnchorExclusive function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.

Choice Group Setup

For choiceGroupAnchorExclusive to work, the choice group names MUST NOT be hidden in Qualtrics.

To hide choice group names on an individual basis, put the group name inside a span with the class hide. For example:

<span class="hide">Group name</span>

If ALL choice groups are to be hidden and only 'anchor' functionality is required ('exclusive' is NOT required), choice groups can be removed after anchoring by using the removeCgs option.

Choice Setup

To anchor a choice within the choice group, put the choice text inside a span with the class anchor. For example:

<span class="anchor">Choice text</span>

To make a choice exclusive within a choice group, put the choice text inside a span with the class exclusive. For example:

<span class="exclusive">Choice text</span>

To anchor and make a choice exclusive within a choice group, put the choice text inside a span with the classes anchor and exclusive. For example:

<span class="anchor exclusive">Choice text</span>

If there are multiple anchored choices within a choice group, exclusive choices will be anchored below non-exclusive choices.

JavaScript Function Call

Call the choicegroupAnchorExclusive function from the question's addOnload function using the default settings as follows:

Qualtrics.SurveyEngine.addOnload(function() {
	choicegroupAnchorExclusive(this);
});

To override the default options, specify the desired options in the second function argument as an object. For example:

Qualtrics.SurveyEngine.addOnload(function() {
	choicegroupAnchorExclusive(this,{removeCgs:true});
});

See Options for details.

Options

removeCgs

removeCgs is a boolean that specifies if choice groups should be removed after choices are anchored. Setting removeCgs to true cancels all exclusive choice group functionality since choice groups are required for operation. Therefore, removeCgs should only be used if only anchor functionality if required.

Default: false

Qualtrics Wiki

choicegroupanchorexclusive.txt · Last modified: 2023/09/24 15:47 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki