Advanced Programming

From qualtrics

(Difference between revisions)
Jump to: navigation, search
(How to change the width of text boxes in question types other than Text Entry)
Current revision (09:33, 30 September 2013) (edit) (undo)
(Require a respondent to spend minimum time per page)
 
(12 intermediate revisions not shown.)
Line 1: Line 1:
-
== How to change the width of text boxes in question types ==
+
Qualtrics Coder's Corner
-
You can paste the following CSS code either into the "code view" of an individual question or into your [[header]] to apply to the entire survey (Find the header in the [[Look and Feel]] section). Then, you will adjust the width value to meet your needs.
+
http://www.qualtrics.com/university/coders-corner/
-
<BR><style>
+
== Change the width of text boxes ==
 +
The text entry box is not the right size. How do I change this?
 +
 
 +
Qualtrics resource:
 +
http://www.qualtrics.com/university/adjust-the-size-of-the-essay-text-entry-box/
 +
 
 +
You can paste the following CSS code either into the "code view" of an individual question or into your header to apply to the entire survey (Find the header in the [https://webservices.itcs.umich.edu/mediawiki/qualtrics/index.php/Survey_Editor#Look_.26_Feel Look and Feel] section).  Then, you will adjust the width value to meet your needs. If you place it in an individual question only, it will change the text box for questions on that page. The rest of the survey is unaffected when implemented.
 +
 
 +
===For Multiple Choice questions===
 +
<style>
<BR>Skin .QuestionBody .TextEntryBox {
<BR>Skin .QuestionBody .TextEntryBox {
<BR>width:10em;
<BR>width:10em;
Line 9: Line 18:
<BR></style>
<BR></style>
 +
Change the number to change the width
-
For Side by Side Questions
+
===For Side by Side Questions===
-
 
+
<style>
-
<BR><style>
+
<BR>.Skin .SBS .Short {
<BR>.Skin .SBS .Short {
<BR>width:50px;
<BR>width:50px;
Line 20: Line 29:
Change the number to change the width
Change the number to change the width
-
== How to give feedback based on answers to multiple choice questions ==
+
== Change line spacing in the question text ==
-
The calculations and feedback are achieved by using the [[Scoring]] feature available in [[Advanced Survey Options]] during survey editing. The scoring feature allows you to assign numerical values to the multiple choice questions and then add the scores.  
+
Please add the following code to the HTML view of the question text: (150% can be changed to anything)
 +
 
 +
<BR><style>
 +
<BR>.Skin .QuestionText {
 +
<BR>line-height: 150%;}
 +
<BR></style>
 +
 
 +
== Auto-populate text entry fields ==
 +
 
 +
http://www.qualtrics.com/university/auto-populating-answer-choice-fields/
 +
 
 +
=== Matrix Text Entry ===
 +
 
 +
In JS, for matrix text entry questions, you preset the value using the following code:
 +
 
 +
var InputId = $("QR~QID2~1~1~TEXT");
 +
InputId.value= "x";
 +
 
 +
The variable name can be whatever you choose.
 +
The Question ID will change based on the question.
 +
The first number after the question ID is the row.
 +
The second number after the question ID is the column.
 +
The value must be set between quotes.
 +
 
 +
If you are using carry forward to populate the statements and/or choices, an “x” must precede the row or column number, for example carrying forward both the choices and statements.
 +
 
 +
var InputId = $("QR~QID2~x1~x1~TEXT");
 +
InputId.value= "x";
 +
 
 +
== Give feedback based on answers to multiple choice questions ==
 +
 
 +
The calculations and feedback are achieved by using the Scoring feature available in [[Advanced Survey Options]] during survey editing. The scoring feature allows you to assign numerical values to the multiple choice questions and then add the scores.  
   
   
-
Feedback based on the score can be determined by a series of questions using [[Display Logic|display logic]]. First, the score must be set as [[Embedded Data|embedded data]] after the data-gathering block through the [[Survey Flow|survey flow]]. In the next block, you can call on this embedded data to create your display logic and display different sets of feedback depending on the score.
+
Feedback based on the score can be determined by a series of questions using display logic. First, the score must be set as embedded data after the data-gathering block through the survey flow tool. In the next block, you can call on this embedded data to create your display logic and display different sets of feedback depending on the score.
-
== How to require a respondent to spend minimum time per page ==
+
== Program a word search question (hide hotpot outlines) ==
-
Add the following to the "Add to javascript" question option:
+
Paste the following code into the HTML code view of the question:
 +
<BR>
 +
<BR><style>
 +
<BR>.Skin .HotSpot .Region:hover{
 +
<BR>border: 0px;
 +
<BR>}
 +
<BR>.Skin .HotSpot .Region:hover .RegionInner{
 +
<BR>border: 0px;
 +
<BR>}
 +
<BR></style>
<BR>
<BR>
-
<BR>Qualtrics.SurveyEngine.addOnload(function()
 
-
<BR>{
 
-
<BR>this.hideNextButton();
 
-
<BR>this.clickNextButton.delay(1500);
 
-
<BR>});
 
 +
The effects only manifest in the survey preview and actual survey sessions.
-
== How to save information from a URL ==
+
== Require a respondent to spend minimum time per page ==
 +
 
 +
This is now integrated into the "Timing" Question type.
 +
 
 +
== Save information from a URL ==
In order to save information from a URL, you will need to embed the data. Otherwise, the information does not automatically get stored anywhere in your survey.  
In order to save information from a URL, you will need to embed the data. Otherwise, the information does not automatically get stored anywhere in your survey.  
Line 48: Line 97:
#* To embed data, use the Survey Flow tool. From Edit Survey, go to Survey Flow.
#* To embed data, use the Survey Flow tool. From Edit Survey, go to Survey Flow.
#* Find the Block where you collect the subject information. Click “Add Below” and Click “Embedded Data”.
#* Find the Block where you collect the subject information. Click “Add Below” and Click “Embedded Data”.
-
#* Set  any [[Embedded Data]] Field Name of your choice  
+
#* Set  any Embedded Data Field Name of your choice  
#* Write the embedded field name as the variable from the URL and allow Qualtrics to Set the Value from the Panel or URL
#* Write the embedded field name as the variable from the URL and allow Qualtrics to Set the Value from the Panel or URL
# Your subject information should appear in the results section under a column called “UID” and is available for passing to other surveys through redirect URLs.
# Your subject information should appear in the results section under a column called “UID” and is available for passing to other surveys through redirect URLs.
#The subject information is saved using the code ${e://Field/UID} – you can now use this code to pass onto more linked surveys. For example,
#The subject information is saved using the code ${e://Field/UID} – you can now use this code to pass onto more linked surveys. For example,
#* http://umich.qualtrics.com/SE?SID=SV_eXNfcfUHy&SVID=Prod&UID=${e://Field/UID}
#* http://umich.qualtrics.com/SE?SID=SV_eXNfcfUHy&SVID=Prod&UID=${e://Field/UID}
-
 
[[Category:Advanced]]
[[Category:Advanced]]

Current revision

Qualtrics Coder's Corner

http://www.qualtrics.com/university/coders-corner/

Contents

[edit] Change the width of text boxes

The text entry box is not the right size. How do I change this?

Qualtrics resource: http://www.qualtrics.com/university/adjust-the-size-of-the-essay-text-entry-box/

You can paste the following CSS code either into the "code view" of an individual question or into your header to apply to the entire survey (Find the header in the Look and Feel section). Then, you will adjust the width value to meet your needs. If you place it in an individual question only, it will change the text box for questions on that page. The rest of the survey is unaffected when implemented.

[edit] For Multiple Choice questions

<style>
Skin .QuestionBody .TextEntryBox {
width:10em;
}
</style>

Change the number to change the width

[edit] For Side by Side Questions

<style>
.Skin .SBS .Short {
width:50px;
}
</style>

Change the number to change the width

[edit] Change line spacing in the question text

Please add the following code to the HTML view of the question text: (150% can be changed to anything)


<style>
.Skin .QuestionText {
line-height: 150%;}
</style>

[edit] Auto-populate text entry fields

http://www.qualtrics.com/university/auto-populating-answer-choice-fields/

[edit] Matrix Text Entry

In JS, for matrix text entry questions, you preset the value using the following code:

var InputId = $("QR~QID2~1~1~TEXT"); InputId.value= "x";

The variable name can be whatever you choose. The Question ID will change based on the question. The first number after the question ID is the row. The second number after the question ID is the column. The value must be set between quotes.

If you are using carry forward to populate the statements and/or choices, an “x” must precede the row or column number, for example carrying forward both the choices and statements.

var InputId = $("QR~QID2~x1~x1~TEXT"); InputId.value= "x";

[edit] Give feedback based on answers to multiple choice questions

The calculations and feedback are achieved by using the Scoring feature available in Advanced Survey Options during survey editing. The scoring feature allows you to assign numerical values to the multiple choice questions and then add the scores.

Feedback based on the score can be determined by a series of questions using display logic. First, the score must be set as embedded data after the data-gathering block through the survey flow tool. In the next block, you can call on this embedded data to create your display logic and display different sets of feedback depending on the score.


[edit] Program a word search question (hide hotpot outlines)

Paste the following code into the HTML code view of the question:

<style>
.Skin .HotSpot .Region:hover{
border: 0px;
}
.Skin .HotSpot .Region:hover .RegionInner{
border: 0px;
}
</style>

The effects only manifest in the survey preview and actual survey sessions.

[edit] Require a respondent to spend minimum time per page

This is now integrated into the "Timing" Question type.

[edit] Save information from a URL

In order to save information from a URL, you will need to embed the data. Otherwise, the information does not automatically get stored anywhere in your survey.

  1. Identify the variable name from the URL. For example
  2. This variable will need to be embedded in order to be saved to the results of the linked survey.
    • To embed data, use the Survey Flow tool. From Edit Survey, go to Survey Flow.
    • Find the Block where you collect the subject information. Click “Add Below” and Click “Embedded Data”.
    • Set any Embedded Data Field Name of your choice
    • Write the embedded field name as the variable from the URL and allow Qualtrics to Set the Value from the Panel or URL
  3. Your subject information should appear in the results section under a column called “UID” and is available for passing to other surveys through redirect URLs.
  4. The subject information is saved using the code ${e://Field/UID} – you can now use this code to pass onto more linked surveys. For example,
Personal tools